Skip to content

Commit b764f1a

Browse files
committed
fix: if destroy lock set destroy lock on start - destroy locks after starting listening
1 parent 8af25ae commit b764f1a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/PgIpLock.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,6 @@ export class PgIpLock implements AnyLock {
112112
await this.createSchema();
113113
await Promise.all([this.createLock(), this.createDeadlockCheck()]);
114114

115-
// istanbul ignore if
116-
if (DESTROY_LOCK_ON_START) {
117-
await destroyLock();
118-
}
119-
120115
if (this.notifyHandler) {
121116
this.options.pgClient.on('notification', this.notifyHandler);
122117
}
@@ -131,6 +126,11 @@ export class PgIpLock implements AnyLock {
131126
async () => !this.acquired && this.acquire(),
132127
this.options.acquireInterval,
133128
));
129+
130+
// istanbul ignore if
131+
if (DESTROY_LOCK_ON_START) {
132+
await destroyLock();
133+
}
134134
}
135135

136136
/**

0 commit comments

Comments
 (0)