# AnyLock.onAcquire() method · @imqueue/pg-pubsub

Source: https://imqueue.org/api/pg-pubsub/latest/pg-pubsub.anylock.onacquire/
Published: 2026-08-01
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/pg-pubsub 3.0.5 — generated reference, not hand-written

Implements late lock acquire handler upset. The handler is called when the lock gets taken over by a retry, long after the acquire() caller has given up - which makes it the only chance for that caller to finish whatever the lock was being acquired for.

**Signature:**

```typescript
onAcquire(handler: (channel: string) => void): void;
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| handler | (channel: string) => void | called with the channel name when a retry finally wins the lock, potentially long after acquire() resolved false |


**Returns:**

void

