diff --git a/main.py b/main.py index 0d037e8..5ab334f 100644 --- a/main.py +++ b/main.py @@ -155,8 +155,9 @@ if __name__ == '__main__': # It's safer to configure these via a reverse proxy (like Nginx) in production. # Hypercorn's defaults are usually reasonable. Let's comment these out for now. - # Assign startup and shutdown handlers - config.startup_hooks = [startup_event] + # Shutdown handler only — startup is handled manually in run_server_with_startup() + # so we can launch GraphRAG as a background task in the same event loop. + # Do NOT register startup_event as a hook here (it would run twice). config.shutdown_hooks = [shutdown_event] log_structured('info', f"Starting Hypercorn server on {SERVER_HOST}:{SERVER_PORT}")