Resolve "Beacon async crashes with mixed slow/fast concurrent requests"
requested to merge 19-beacon-async-crashes-with-mixed-slow-fast-concurrent-requests into 15-connection-pool-busy
Improves Beacon stability under concurrent heavy query load by adding a semaphore with timeout to the request handlers.
Changes
- Add asyncio.Semaphore to limit concurrent heavy queries (2+ filters) and protect the connection pool
- Queries with 0 or 1 filter bypass the semaphore entirely (is_heavy_query check)
- Add HEAVY_Q_TIMEOUT and MAX_CONCURRENT_HEAVY_QUERIES in confTemplate.py for easy configuration
- If a heavy query waits more than HEAVY_Q_TIMEOUT seconds in the semaphore queue, Beacon returns 503 Service Unavailable instead of letting the client timeout silently
Closes #19 (closed)
Edited by NESRINE FEKIH