moonraker: add the SIGTERM handler in server_init()

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-02-04 20:14:27 -05:00
parent 1072958534
commit 9e9f9ee0fd
1 changed files with 3 additions and 2 deletions

View File

@ -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():