Handle SIGTERM and SIGINT in the query server
Restore SIGTERM and SIGINT handling for the query server, which lost its Asio signal handlers in the HTTP API rewrite (#155). Without a handler, Linux leaves a container's PID 1 running until Docker escalates to SIGKILL.
Register the signals before index loading, stop HTTP handling from the waiting main thread, and let the workers and loader finish before releasing the index. The wait adds no polling or query-worker thread.
In a local Docker test with deliberately delayed cleanup, docker stop --timeout 30 completed normally after 12–14 seconds; a ten-second timeout escalated to SIGKILL. Existing connections close during shutdown, and loading already in progress finishes before exit.
Implemented with OpenAI Codex.
Summary by cubic
Restores SIGTERM and SIGINT handling in the query server, so docker stop and Ctrl+C now shut it down cleanly instead of waiting for Docker to SIGKILL it.
- Registers signal handlers before index loading and waits without polling, so termination works when running as PID 1.
- Stops HTTP handling from the main thread and lets the workers and loader finish before releasing the index.
- Adds integration tests covering both signals, multiple threads, mmap mode, and shutdown during startup; the startup tests hold the server at an index-list FIFO read, synchronized from the reading end on macOS, to verify shutdown while loading is still pending.