From 9e9f9ee0fd49e82d6362c1b054d0068204d5a00a Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Fri, 4 Feb 2022 20:14:27 -0500 Subject: [PATCH] moonraker: add the SIGTERM handler in server_init() Signed-off-by: Eric Callahan --- moonraker/moonraker.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/moonraker/moonraker.py b/moonraker/moonraker.py index e1ed629..811ba90 100755 --- a/moonraker/moonraker.py +++ b/moonraker/moonraker.py @@ -146,8 +146,6 @@ class Server: self.register_remote_method( 'process_status_update', self._process_status_update, need_klippy_reg=False) - self.event_loop.add_signal_handler( - signal.SIGTERM, self._handle_term_signal) @property def klippy_apis(self) -> KlippyAPI: @@ -178,6 +176,9 @@ class Server: return config async def server_init(self, start_server: bool = True) -> None: + self.event_loop.add_signal_handler( + signal.SIGTERM, self._handle_term_signal) + # Perform asynchronous init after the event loop starts optional_comps: List[Coroutine] = [] for name, component in self.components.items():