Skip to content

Commit

Permalink
always attempt to clear reject timer in subscriptions (#264)
Browse files Browse the repository at this point in the history
* always attempt to clear reject timer in subscriptions

* version bump

* version bump
  • Loading branch information
timgit authored Aug 13, 2021
1 parent a391486 commit b226877
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pg-boss",
"version": "6.2.0",
"version": "6.2.1",
"description": "Queueing jobs in Node.js using PostgreSQL like a boss",
"main": "./src/index.js",
"engines": {
Expand Down
10 changes: 7 additions & 3 deletions src/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,15 @@ class Manager extends EventEmitter {
const timeout = Math.max(1, seconds) * 1000
const reject = delay.reject(timeout, { value: new Error(`handler execution exceeded ${timeout}ms`) })

const result = await Promise.race([promise, reject])
let result

try {
reject.clear()
} catch {}
result = await Promise.race([promise, reject])
} finally {
try {
reject.clear()
} catch {}
}

return result
}
Expand Down

0 comments on commit b226877

Please sign in to comment.