Skip to content

Commit

Permalink
Improve metalayer snapshot on shutdown (#6067)
Browse files Browse the repository at this point in the history
We can't know whether `s.quitCh` or `qch` will fire first, since the
`select` order is indeterminate. Try to snapshot either way.

Signed-off-by: Neil Twigg <[email protected]>
  • Loading branch information
derekcollison authored Nov 1, 2024
2 parents 02adbb9 + dccac5b commit f404ea2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions server/jetstream_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,8 @@ func (js *jetStream) monitorCluster() {
for {
select {
case <-s.quitCh:
// Server shutting down, but we might receive this before qch, so try to snapshot.
doSnapshot()
return
case <-rqch:
return
Expand Down

0 comments on commit f404ea2

Please sign in to comment.