Skip to content

fix: QueuePool hygiene for job-poll auth (mainline) - #226

Closed
suguanYang wants to merge 2 commits into
mainfrom
fix/suguanYang/queuepool-job-poll-hygiene
Closed

fix: QueuePool hygiene for job-poll auth (mainline)#226
suguanYang wants to merge 2 commits into
mainfrom
fix/suguanYang/queuepool-job-poll-hygiene

Conversation

@suguanYang

Copy link
Copy Markdown
Contributor

Summary

  • Stop nested QueuePool checkouts on job-poll auth by reusing the request AsyncSession for tier lookup and API-key last_used updates (Redis SET NX debounce).
  • Wire async engine to DB_POOL_SIZE / DB_MAX_OVERFLOW defaults of 50/50 so legal poll bursts no longer exhaust the per-process pool.
  • Dual delivery: this is the mainline PR into main; a sibling hotfix targets prod cut v2026.06.18.2 via release/v2026.06.18.2. No rate-limit policy changes.

Test plan

  • Unit tests: apps/api/tests/unit/test_job_poll_session_hygiene.py and shared/tests/test_database_pool_config.py
  • Confirm job poll / auth paths hold a single session (no nested get_db_context for tier + last_used)
  • Confirm pool defaults/env read as 50/50; no change to rate-limit admission behavior
  • Smoke: concurrent job-status polls under load do not hit QueuePool timeout

Made with Cursor

suguanYang and others added 2 commits July 25, 2026 20:14
Reuse the request AsyncSession for tier lookup and API-key last_used
updates (with Redis debounce), and wire the async engine to
DB_POOL_SIZE/MAX_OVERFLOW defaults of 50/50 so legal poll bursts no
longer exhaust the per-process pool via nested get_db_context holds.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use Redis SET NX for last-used debounce, require the request session in
resolve_current_user, and avoid double-commit when TierService owns the session.

Co-authored-by: Cursor <cursoragent@cursor.com>
@suguanYang suguanYang closed this Jul 25, 2026
@suguanYang
suguanYang deleted the fix/suguanYang/queuepool-job-poll-hygiene branch July 25, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant