server: sleep 1ms after calling component close methods
This allows any cancelled tasks to run through the eventloop before loop.stop() is called. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
09550af466
commit
0a0993f9e0
|
@ -373,6 +373,8 @@ class Server:
|
||||||
except Exception:
|
except Exception:
|
||||||
logging.exception(
|
logging.exception(
|
||||||
f"Error executing 'close()' for component: {name}")
|
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.exit_reason = exit_reason
|
||||||
self.event_loop.remove_signal_handler(signal.SIGTERM)
|
self.event_loop.remove_signal_handler(signal.SIGTERM)
|
||||||
|
|
Loading…
Reference in New Issue