Fix shutdown timeouts (#695)

Co-authored-by: AAGaming <aagaming@riseup.net>
This commit is contained in:
Sims
2024-09-01 20:15:49 +02:00
committed by GitHub
parent 4842a599e0
commit 016ed6e998
9 changed files with 70 additions and 44 deletions
+7 -1
View File
@@ -101,6 +101,8 @@ class PluginManager:
self.web_app.add_routes([static("/static", path.join(path.dirname(__file__), 'static'))])
async def handle_crash(self):
if not self.reinject:
return
new_time = time()
if (new_time - self.last_webhelper_exit < 60):
self.webhelper_crash_count += 1
@@ -118,9 +120,13 @@ class PluginManager:
async def shutdown(self, _: Application):
try:
logger.info(f"Shutting down...")
logger.info("Disabling reload...")
await self.plugin_loader.disable_reload()
logger.info("Killing plugins...")
await self.plugin_loader.shutdown_plugins()
await self.ws.disconnect()
logger.info("Disconnecting from WS...")
self.reinject = False
await self.ws.disconnect()
if self.js_ctx_tab:
await self.js_ctx_tab.close_websocket()
self.js_ctx_tab = None