Skip to content

Commit

Permalink
Add comment to locking code
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-farries committed Feb 26, 2024
1 parent 001f9ac commit 4cf0e6a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,9 @@ func (s *State) Init(ctx context.Context) error {
}
defer tx.Rollback()

// Try to obtain an advisory lock
// Try to obtain an advisory lock.
// The key is an arbitrary number, used to distinguish the lock from other locks.
// The lock is automatically released when the transaction is committed or rolled back.
const key int64 = 0x2c03057fb9525b
_, err = tx.ExecContext(ctx, "SELECT pg_advisory_xact_lock($1)", key)
if err != nil {
Expand Down

0 comments on commit 4cf0e6a

Please sign in to comment.