Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cabotage/celery/tasks/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,12 @@ def deploy_release(deployment):
],
),
)
# Commit the session before running release commands (e.g., migrations)
# to release any row/table locks. Without this, migrations that ALTER
# tables read by this task will deadlock — the migration waits for our
# lock, and we wait for the migration to finish.
db.session.commit()
db.session.refresh(deployment)
for release_command in deployment.release_object.release_commands:
deploy_log.append(f"Running release command {release_command}")
job_object = render_job(
Expand Down