Skip to content

Commit

Permalink
Rename lameDuckMode to LameDuckShutdown so that it is accessible …
Browse files Browse the repository at this point in the history
…when embedding NATS

Otherwise this function isn't available when embedding the NATS Server,
where using `SIGUSR2` likely isn't appropriate.

Signed-off-by: Neil Twigg <neil@nats.io>
  • Loading branch information
neilalexander authored and wallyqs committed Jul 16, 2024
1 parent 06a573c commit 9a57e69
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4098,6 +4098,16 @@ func (s *Server) isLameDuckMode() bool {
return s.ldm
}

// LameDuckShutdown will perform a lame duck shutdown of NATS, whereby
// the client listener is closed, existing client connections are
// kicked, Raft leaderships are transferred, JetStream is shutdown
// and then finally shutdown the the NATS Server itself.
// This function blocks and will not return until the NATS Server
// has completed the entire shutdown operation.
func (s *Server) LameDuckShutdown() {
s.lameDuckMode()
}

// This function will close the client listener then close the clients
// at some interval to avoid a reconnect storm.
// We will also transfer any raft leaders and shutdown JetStream.
Expand Down

0 comments on commit 9a57e69

Please sign in to comment.