Skip to content

Commit

Permalink
perf: set 1s limit for graceful shutdown to avoid waiting for a stuck…
Browse files Browse the repository at this point in the history
… redis (#572)

Signed-off-by: Rueian <rueiancsie@gmail.com>
  • Loading branch information
rueian authored Jun 17, 2024
1 parent 463b6c3 commit 4d59a58
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -1480,7 +1480,10 @@ func (p *pipe) Close() {
p.background()
}
if block == 1 && (stopping1 || stopping2) { // make sure there is no block cmd
<-p.queue.PutOne(cmds.PingCmd)
select {
case <-p.queue.PutOne(cmds.PingCmd):
case <-time.After(time.Second):
}
}
}
atomic.AddInt32(&p.waits, -1)
Expand Down

0 comments on commit 4d59a58

Please sign in to comment.