improvement(deployments): shorten lock windows and add tx safety timeouts on the deploy path#5841
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview
Webhook registration store:
Stale-executions cron adds batched pruning of terminal Reviewed by Cursor Bugbot for commit c9e9909. Configure here. |
Greptile SummaryThis PR reduces lock time and adds safety limits to the workflow deployment path. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (2): Last reviewed commit: "improvement(deployments): shorten lock w..." | Re-trigger Greptile |
…outs on the deploy path
97d245d to
c9e9909
Compare
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit c9e9909. Configure here.
Summary
checkpointWebhookCandidateis now a single fenced UPDATE (no transaction, no workflow-row lock) — it runs after every external provider call, so it no longer holds webhook locks across client round trips; operation currency is asserted in-statement via exists/notExistswebhook_active_registration_uniqueforbids vacate+claim in one statement)workflow_deployment_versionpair into one UPDATE that only touches rows whoseis_activeactually changes (stops rewriting every version row on every deploy)FOR UPDATEfrom the webhook cleanup snapshot/delete helperssetDeploymentTxTimeouts(statement 30s / lock 5s / idle-in-tx 30s viaset_config(..., true), PgBouncer-safe, one round trip) applied to all 8 deployment-path transactions so a wedged client can never pin webhook/workflow locks indefinitelyworkflow_deployment_operationrows (>30d) in the stale-executions cron; the newest-generation row per workflow is structurally excluded so generation numbering stays monotonicContext
Follow-up to the PlanetScale lock-spike alert: idle-in-transaction sessions holding RowExclusiveLocks on
webhook+ its indexes during concurrent deploys. Root cause was multi-statement transactions idling between round trips, not traffic.Type of Change
Testing
All 7 affected suites pass (95 tests); SQL rendering verified against drizzle 0.45.2 via toSQL(); semantics of merged statements audited for bit-identical column values vs the old statement pairs
Checklist