Remove dead acquireAdvisoryXactLock try variant
The transaction-scoped TRY variant had no production callers — only the conn-level try-lock (acquireAdvisoryLock) and the blocking xact variant (acquireAdvisoryXactLockBlocking, used by the admin cancellation path) are in use. Dropping the dead code removes a foot-gun: a try-lock that silently fails to acquire inside a transaction would otherwise look like a safe option.
This commit is contained in:
@@ -39,15 +39,8 @@ func acquireAdvisoryLock(ctx context.Context, conn *pgxpool.Conn, key string) (b
|
||||
return tryAdvisoryLock(ctx, conn, key, "pg_try_advisory_lock")
|
||||
}
|
||||
|
||||
// acquireAdvisoryXactLock is the transaction-scoped variant of
|
||||
// acquireAdvisoryLock: the lock is held on the transaction and auto-released
|
||||
// at commit/rollback, so the caller must NOT unlock explicitly.
|
||||
func acquireAdvisoryXactLock(ctx context.Context, tx pgx.Tx, key string) (bool, error) {
|
||||
return tryAdvisoryLock(ctx, tx, key, "pg_try_advisory_xact_lock")
|
||||
}
|
||||
|
||||
// acquireAdvisoryXactLockBlocking is the transaction-scoped BLOCKING variant
|
||||
// of acquireAdvisoryXactLock: it issues `SELECT pg_advisory_xact_lock(...)`
|
||||
// of acquireAdvisoryLock: it issues `SELECT pg_advisory_xact_lock(...)`
|
||||
// ONCE and waits for as long as the key is contended — there is no 3s bound.
|
||||
// The lock is transaction-scoped, so it is auto-released at the caller's
|
||||
// commit/rollback (never unlocked explicitly).
|
||||
|
||||
Reference in New Issue
Block a user