Skip to content

Commit 8345198

Browse files
authored
chore: support graceful shutdown (#4)
1 parent e5c5b48 commit 8345198

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

nsq.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,9 @@ func (w *Worker) Shutdown() error {
240240

241241
w.stopOnce.Do(func() {
242242
if atomic.LoadInt32(&w.startFlag) == 1 {
243+
w.q.ChangeMaxInFlight(0)
243244
w.q.Stop()
245+
<-w.q.StopChan
244246
w.p.Stop()
245247
}
246248

0 commit comments

Comments
 (0)