fix: QueuePool hygiene for job-poll auth (mainline) - #226
Closed
suguanYang wants to merge 2 commits into
Closed
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AsyncSessionfor tier lookup and API-keylast_usedupdates (Redis SET NX debounce).DB_POOL_SIZE/DB_MAX_OVERFLOWdefaults of 50/50 so legal poll bursts no longer exhaust the per-process pool.main; a sibling hotfix targets prod cutv2026.06.18.2viarelease/v2026.06.18.2. No rate-limit policy changes.Test plan
apps/api/tests/unit/test_job_poll_session_hygiene.pyandshared/tests/test_database_pool_config.pyget_db_contextfor tier + last_used)Made with Cursor