Skip to content

Commit

Permalink
make sure MonitorGroup gRPC server stops gracefully
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Indenbaum <[email protected]>
  • Loading branch information
Alexander Indenbaum committed Dec 18, 2023
1 parent 919847a commit 49c840e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions control/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,10 @@ def _wait_for_group_id(self):
self.logger.info(f"MonitorGroup server is listening on {self._monitor_address()} for group id")
self.monitor_event.wait()
self.monitor_event = None
self.logger.info("Stopping the monitor server...")
self.monitor_server.stop(None)
self.logger.info("Stopping the MonitorGroup server...")
grace = self.config.getfloat_with_default("gateway", "monitor_stop_grace", 1/1000)
self.monitor_server.stop(grace).wait()
self.logger.info("The MonitorGroup gRPC server stopped...")
self.monitor_server = None

def serve(self):
Expand Down

0 comments on commit 49c840e

Please sign in to comment.