mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(coderd): add blocking GetProvisionerJobByIDWithLock for workspace build cancellation (#19737)
Closes https://github.com/coder/internal/issues/885 Adds a new database method GetProvisionerJobByIDWithLock that uses FOR UPDATE without SKIP LOCKED to fix workspace build cancellation returning 500 errors when jobs are locked.
This commit is contained in:
@@ -55,6 +55,17 @@ WHERE
|
||||
FOR UPDATE
|
||||
SKIP LOCKED;
|
||||
|
||||
-- name: GetProvisionerJobByIDWithLock :one
|
||||
-- Gets a provisioner job by ID with exclusive lock.
|
||||
-- Blocks until the row is available for update.
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
provisioner_jobs
|
||||
WHERE
|
||||
id = $1
|
||||
FOR UPDATE;
|
||||
|
||||
-- name: GetProvisionerJobsByIDs :many
|
||||
SELECT
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user