mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
Issue a JWT ticket on the first request with a short expiry that contains details about which workspace/agent/app combo the ticket is valid for.
18 lines
635 B
SQL
18 lines
635 B
SQL
-- name: AcquireLock :exec
|
|
-- Blocks until the lock is acquired.
|
|
--
|
|
-- 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
|
|
-- Non blocking lock. Returns true if the lock was acquired, false otherwise.
|
|
--
|
|
-- 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);
|