The ORM is async end to end - #324
Merged
Merged
Conversation
Flag-day switch of every session to SQLAlchemy's AsyncSession on the serving loop: async engine + async_scoped_session task registry, a request-owned session bound per request and committed at the boundary, step_session for durable steps, and async model/read surfaces throughout. Sync engines remain only for one-shot processes (migrate, CLI, doctor's plain checks). ENG-672.
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.
Flag-day switch of every ORM session to SQLAlchemy's
AsyncSessionon the serving loop. The sync pool checkout was the last blocking call left in the process: under load it froze the event loop inpool_timeoutslices. Now a checkout wait suspends the task — exhaustion is backpressure, not a freeze.create_async_engine, pool 20+30) with the sync engine kept only for one-shot processes: migrations, CLI, doctor's plain checks.db_sessionis anasync_scoped_sessionkeyed by task. Each request binds its own session and commits at the boundary; durable steps keep the one-transaction-per-step shape throughstep_session.DBOS.launch()runs inside the async lifespan so async steps share the serving loop; schedule reconciliation uses the*_asyncschedule APIs.async defthroughout; lazy relationship reads go throughawaitable_attrswhere a load is intended, andWorkflow.subjectresolves as an awaitable.1329 backend tests green; pyright error count below the main baseline.
ENG-672.
🤖 Generated with Claude Code