mirror of
https://github.com/iio612/DEFENDER.git
synced 2026-02-13 19:24:23 +00:00
Fix blocking Coroutines when shutdown!
This commit is contained in:
@@ -495,11 +495,17 @@ class Base:
|
||||
async def shutdown(self) -> None:
|
||||
"""Methode qui va préparer l'arrêt complêt du service
|
||||
"""
|
||||
# Stop RpcServer if running
|
||||
await self.Loader.RpcServer.stop_server()
|
||||
|
||||
# unload modules.
|
||||
self.logs.debug(f"=======> Unloading all modules!")
|
||||
for module in self.Loader.ModuleUtils.model_get_loaded_modules().copy():
|
||||
await self.Loader.ModuleUtils.unload_one_module(module.module_name)
|
||||
|
||||
self.logs.debug(f"=======> Closing all Coroutines!")
|
||||
await asyncio.gather(*self.running_asynctasks)
|
||||
|
||||
# Nettoyage des timers
|
||||
self.logs.debug(f"=======> Checking for Timers to stop")
|
||||
for timer in self.running_timers:
|
||||
@@ -527,8 +533,6 @@ class Base:
|
||||
self.running_sockets.remove(soc)
|
||||
self.logs.debug(f"> Socket ==> closed {str(soc.fileno())}")
|
||||
|
||||
await self.Loader.RpcServer.stop_server()
|
||||
|
||||
self.db_close()
|
||||
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user