Skip to content

Commit

Permalink
Export LameDuckShutdown so that it is accessible when embedding NATS (
Browse files Browse the repository at this point in the history
#5660)

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
derekcollison authored Jul 16, 2024
2 parents 702640c + 11c5ba2 commit fd284c8
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 @@ -4150,6 +4150,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 fd284c8

Please sign in to comment.