Skip to content

Commit 54fd7f3

Browse files
committed
Clarify .add() docs
Fixes #232
1 parent 701453e commit 54fd7f3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

readme.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,13 @@ If `true`, specifies that any [pending](https://developer.mozilla.org/en-US/docs
135135

136136
Adds a sync or async task to the queue.
137137

138-
Returns a promise with the return value of `fn`.
138+
Returns a promise that settles when the task completes, not when it's added to the queue. The promise resolves with the return value of `fn`.
139139

140-
Note: If your items can potentially throw an exception, you must handle those errors from the returned Promise or they may be reported as an unhandled Promise rejection and potentially cause your process to exit immediately.
140+
> [!IMPORTANT]
141+
> If you `await` this promise, you will wait for the task to finish running, which may defeat the purpose of using a queue for concurrency. See the [Usage](#usage) section for examples.
142+
143+
> [!NOTE]
144+
> If your items can potentially throw an exception, you must handle those errors from the returned Promise or they may be reported as an unhandled Promise rejection and potentially cause your process to exit immediately.
141145
142146
##### fn
143147

0 commit comments

Comments
 (0)