From ecdf0847a681ea7b20ad0a2ffef8ef9e5d9ccab2 Mon Sep 17 00:00:00 2001 From: Peter Broadhurst Date: Mon, 11 Oct 2021 15:56:20 -0400 Subject: [PATCH 1/2] Avoid holding batchCond while dispatching updateInterrupt Signed-off-by: Peter Broadhurst --- internal/events/eventstream.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/events/eventstream.go b/internal/events/eventstream.go index 61b3ade3..79d60736 100644 --- a/internal/events/eventstream.go +++ b/internal/events/eventstream.go @@ -541,11 +541,11 @@ func (a *eventStream) batchProcessor() { a.batchCond.L.Lock() for !a.suspendOrStop() && a.batchQueue.Len() == 0 { if a.updateInProgress { + a.batchCond.L.Unlock() <-a.updateInterrupt // we were notified by the caller about an ongoing update, return log.Infof("%s: Notified of an ongoing stream update, exiting batch processor", a.spec.ID) a.updateWG.Done() //Not moving this to a 'defer' since we need to unlock after calling Done() - a.batchCond.L.Unlock() return } else { a.batchCond.Wait() From c767026e93921912c1943ab907f263b75cd43ed3 Mon Sep 17 00:00:00 2001 From: Peter Broadhurst Date: Mon, 11 Oct 2021 16:54:13 -0400 Subject: [PATCH 2/2] Review comment Signed-off-by: Peter Broadhurst --- internal/events/eventstream.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/events/eventstream.go b/internal/events/eventstream.go index 79d60736..a4143ca7 100644 --- a/internal/events/eventstream.go +++ b/internal/events/eventstream.go @@ -545,7 +545,7 @@ func (a *eventStream) batchProcessor() { <-a.updateInterrupt // we were notified by the caller about an ongoing update, return log.Infof("%s: Notified of an ongoing stream update, exiting batch processor", a.spec.ID) - a.updateWG.Done() //Not moving this to a 'defer' since we need to unlock after calling Done() + a.updateWG.Done() return } else { a.batchCond.Wait()