Skip to content

Commit 380264e

Browse files
jopemachineclaude
andcommitted
fix: eager-load EndpointRow.current_revision_row in get_deployment_data
The DBSource's ``get_deployment_data`` was still selectinload-ing ``EndpointRow.revisions`` while the projection method ``to_model_deployment_data`` reads ``current_revision_row`` / ``deploying_revision_row`` directly. Those relationships default to ``lazy="select"``, so accessing them on a row fetched under an async session would trip the SQLAlchemy ``greenlet_spawn`` error on every API path that calls ``get_deployment_data`` (``create_deployment``, ``update_deployment``, ``get_deployment_by_id``, ``activate_revision``). Align the eager-load with what ``admin_search_deployments`` / ``search_user_deployments`` / ``search_project_deployments`` already do, and drop the now-unused ``revisions`` chain. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e322721 commit 380264e

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

  • src/ai/backend/manager/repositories/deployment/db_source

src/ai/backend/manager/repositories/deployment/db_source/db_source.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,8 @@ async def get_deployment_data(
417417
sa.select(EndpointRow)
418418
.where(EndpointRow.id == endpoint_id)
419419
.options(
420-
selectinload(EndpointRow.revisions).selectinload(
421-
DeploymentRevisionRow.image_row
422-
),
420+
selectinload(EndpointRow.current_revision_row),
421+
selectinload(EndpointRow.deploying_revision_row),
423422
selectinload(EndpointRow.deployment_policy),
424423
)
425424
)

0 commit comments

Comments
 (0)