diff --git a/moonraker/eventloop.py b/moonraker/eventloop.py index 972b8db..9d6642f 100644 --- a/moonraker/eventloop.py +++ b/moonraker/eventloop.py @@ -27,6 +27,9 @@ if TYPE_CHECKING: class EventLoop: TimeoutError = asyncio.TimeoutError def __init__(self) -> None: + self.reset() + + def reset(self) -> None: self.aioloop = asyncio.get_event_loop() self.add_signal_handler = self.aioloop.add_signal_handler self.remove_signal_handler = self.aioloop.remove_signal_handler diff --git a/moonraker/moonraker.py b/moonraker/moonraker.py index a41accd..e1ed629 100755 --- a/moonraker/moonraker.py +++ b/moonraker/moonraker.py @@ -952,7 +952,7 @@ def main() -> None: else: raise RuntimeError("Unable to create new open eventloop") asyncio.set_event_loop(new_loop) - event_loop = EventLoop() + event_loop.reset() event_loop.close() logging.info("Server Shutdown") ql.stop()