Fix double startup: remove startup_event from Hypercorn hooks
startup_event was registered as a Hypercorn startup hook AND called manually in run_server_with_startup(), causing it to execute twice. The second execution blocked the server from accepting connections until vector init completed again. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
fe0d881341
commit
7cd8f26c37
1 changed files with 3 additions and 2 deletions
5
main.py
5
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}")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue