diff --git a/src/main.py b/src/main.py index 59b95bb..0f9e82f 100644 --- a/src/main.py +++ b/src/main.py @@ -288,7 +288,7 @@ async def main(port=80): def settings_page(request): """Serve the settings page.""" return send_file('templates/settings.html') - + # Favicon: avoid 404 in browser console (no file needed) @app.route('/favicon.ico') def favicon(request): @@ -387,6 +387,17 @@ async def main(port=80): ) raise finally: + srv = getattr(app, "server", None) + if srv is not None: + try: + srv.close() + await srv.wait_closed() + except Exception: + pass + try: + app.server = None + except Exception: + pass if shutdown_handlers_registered: for sig in (signal.SIGINT, signal.SIGTERM): try: