fix: preserve first stop shutdown ownership
This commit is contained in:
+3
-1
@@ -197,7 +197,9 @@ func (q *Queue) Stop(contexts ...context.Context) error {
|
||||
}
|
||||
|
||||
q.mu.Lock()
|
||||
shutdownOwner := false
|
||||
if !q.stopped {
|
||||
shutdownOwner = true
|
||||
q.stopped = true
|
||||
q.shutdownCtx = ctx
|
||||
close(q.ch)
|
||||
@@ -222,7 +224,7 @@ func (q *Queue) Stop(contexts ...context.Context) error {
|
||||
case <-done:
|
||||
return nil
|
||||
case <-ctx.Done():
|
||||
if workCancel != nil {
|
||||
if shutdownOwner && workCancel != nil {
|
||||
workCancel()
|
||||
}
|
||||
return ctx.Err()
|
||||
|
||||
Reference in New Issue
Block a user