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

Signed-off-by: Rueian <[email protected]>
  • Loading branch information
rueian committed Jun 17, 2024
1 parent 6831b30 commit 6570c5c
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 6570c5c

Please sign in to comment.