Skip to content

Commit fd284c8

Browse files
Export LameDuckShutdown so that it is accessible when embedding NATS (#5660)
Otherwise this function isn't available when embedding the NATS Server, where using `SIGUSR2` likely isn't appropriate. Signed-off-by: Neil Twigg <[email protected]>
2 parents 702640c + 11c5ba2 commit fd284c8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

server/server.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4150,6 +4150,16 @@ func (s *Server) isLameDuckMode() bool {
41504150
return s.ldm
41514151
}
41524152

4153+
// LameDuckShutdown will perform a lame duck shutdown of NATS, whereby
4154+
// the client listener is closed, existing client connections are
4155+
// kicked, Raft leaderships are transferred, JetStream is shutdown
4156+
// and then finally shutdown the the NATS Server itself.
4157+
// This function blocks and will not return until the NATS Server
4158+
// has completed the entire shutdown operation.
4159+
func (s *Server) LameDuckShutdown() {
4160+
s.lameDuckMode()
4161+
}
4162+
41534163
// This function will close the client listener then close the clients
41544164
// at some interval to avoid a reconnect storm.
41554165
// We will also transfer any raft leaders and shutdown JetStream.

0 commit comments

Comments
 (0)