Skip processed error if an experiment *might* have flagged this event
continuous-integration/drone/pr Build is pending Details

This commit is contained in:
Sarah Jamie Lewis 2023-03-06 13:19:52 -08:00
parent d50f210e35
commit 0139f7a5a9
1 changed files with 16 additions and 0 deletions

View File

@ -1550,6 +1550,11 @@ func (cp *cwtchPeer) eventHandler() {
// check if the current map of experiments satisfies the extension requirements
if !cp.checkExtensionExperiment(extension) {
log.Debugf("skipping extension (%s) ..not all experiments satisfied", extension)
if cp.checkEventExperiment(extension, ev.EventType) {
// If this experiment was enabled...we might have processed this event...
// To avoid flagging an error later on in this method we set processed to true.
processed = true
}
continue
}
@ -1568,6 +1573,17 @@ func (cp *cwtchPeer) eventHandler() {
}
}
func (cp *cwtchPeer) checkEventExperiment(hook ProfileHook, event event.Type) bool {
cp.experimentsLock.Lock()
defer cp.experimentsLock.Unlock()
for hookEvent := range hook.events {
if event == hookEvent {
return true
}
}
return false
}
func (cp *cwtchPeer) checkExtensionExperiment(hook ProfileHook) bool {
cp.experimentsLock.Lock()
defer cp.experimentsLock.Unlock()