Skip to content

Commit 49b7266

Browse files
committed
Add to release notes and docs
1 parent 923c6aa commit 49b7266

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

RELEASE_NOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ Read more:
3939
output via logging (thanks @wineTGH).
4040
- Fix race condition when multiple workers attempt to initialise the database at
4141
the same time
42+
- `helpers.abortSignal` is no longer typed as `| undefined`. It is still
43+
experimental!
44+
- `helpers.abortPromise` added; will reject when `abortSignal` aborts (useful
45+
for `Promise.race()`)
4246

4347
## v0.16.6
4448

website/docs/tasks.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@ Each task function is passed two arguments:
3636
shouldn't need this
3737
- `getQueueName()` — get the name of the queue the job is in (may or may
3838
not return a promise - recommend you always `await` it)
39-
- `abortSignal` — could be an `AbortSignal` or `undefined`; if set, use
40-
this to abort your task early on graceful shutdown (can be passed to a
41-
number of asynchronous Node.js methods)
39+
- `abortSignal` — could be an `AbortSignal`, or `undefined` if not
40+
supported by this release of worker; if set, use this to abort your task
41+
early on graceful shutdown (can be passed to a number of asynchronous
42+
Node.js methods)
43+
- `abortPromise` — if present, a promise that will reject when
44+
`abortSignal` aborts; convenient for exiting your task when the abortSignal
45+
fires: `Promise.race([abortPromise, doYourThing()])`
4246
- `withPgClient` — a helper to use to get a database client
4347
- `query(sql, values)` — a convenience wrapper for
4448
`withPgClient(pgClient => pgClient.query(sql, values))`

0 commit comments

Comments
 (0)