mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
feat: add provisioner job hang detector (#7927)
This commit is contained in:
@ -3,8 +3,6 @@
|
||||
--
|
||||
-- This must be called from within a transaction. The lock will be automatically
|
||||
-- released when the transaction ends.
|
||||
--
|
||||
-- Use database.LockID() to generate a unique lock ID from a string.
|
||||
SELECT pg_advisory_xact_lock($1);
|
||||
|
||||
-- name: TryAcquireLock :one
|
||||
@ -12,6 +10,4 @@ SELECT pg_advisory_xact_lock($1);
|
||||
--
|
||||
-- This must be called from within a transaction. The lock will be automatically
|
||||
-- released when the transaction ends.
|
||||
--
|
||||
-- Use database.LockID() to generate a unique lock ID from a string.
|
||||
SELECT pg_try_advisory_xact_lock($1);
|
||||
|
@ -128,3 +128,13 @@ SET
|
||||
error_code = $5
|
||||
WHERE
|
||||
id = $1;
|
||||
|
||||
-- name: GetHungProvisionerJobs :many
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
provisioner_jobs
|
||||
WHERE
|
||||
updated_at < $1
|
||||
AND started_at IS NOT NULL
|
||||
AND completed_at IS NULL;
|
||||
|
Reference in New Issue
Block a user