Skip to content

Commit 8cb77da

Browse files
committed
Queue manager FlushAll can loop rapidly - add delay
Add delay within FlushAll to prevent rapid loop when workers are busy Signed-off-by: Andrew Thornton <[email protected]>
1 parent 2bd5408 commit 8cb77da

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

modules/queue/manager.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -198,17 +198,15 @@ func (m *Manager) FlushAll(baseCtx context.Context, timeout time.Duration) error
198198
wg.Done()
199199
}(mq)
200200
} else {
201-
log.Debug("Queue: %s is non-empty but is not flushable - adding 100 millisecond wait", mq.Name)
202-
go func() {
203-
<-time.After(100 * time.Millisecond)
204-
wg.Done()
205-
}()
201+
log.Debug("Queue: %s is non-empty but is not flushable", mq.Name)
202+
wg.Done()
206203
}
207-
208204
}
209205
if allEmpty {
206+
log.Debug("All queues are empty")
210207
break
211208
}
209+
<-time.After(100 * time.Millisecond)
212210
wg.Wait()
213211
}
214212
return nil

0 commit comments

Comments
 (0)