diff --git a/moonraker/moonraker.py b/moonraker/moonraker.py index 26164be..ba3cd1e 100755 --- a/moonraker/moonraker.py +++ b/moonraker/moonraker.py @@ -373,6 +373,8 @@ class Server: except Exception: logging.exception( f"Error executing 'close()' for component: {name}") + # Allow cancelled tasks a chance to run in the eventloop + await asyncio.sleep(.001) self.exit_reason = exit_reason self.event_loop.remove_signal_handler(signal.SIGTERM)