Skip to content

Commit b9d1021

Browse files
committed
Update README
1 parent 1c3d661 commit b9d1021

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,19 @@ d4c.setConcurrency([{ limit: 10 }])
152152
d4c.setConcurrency([{ limit: 10, tag: 'queue2' }])
153153
```
154154

155-
When this async task function is called and the system detects the concurrency limit is reached, this tasks will not be really executed and will be enqueued. If you want to drop this task function call, you can set `dropWhenReachLimit` option when wrapping/applying the task function. e.g. `d4c.wrap(taskFun, { dropWhenReachLimit: true })`
155+
When this async task function is called and the system detects the concurrency limit is reached, this tasks will not be really executed and will be enqueued. If you want to drop this task function call, you can set `dropWhenReachLimit` option when wrapping/applying the task function. e.g.
156+
157+
```ts
158+
const fn1 = d4c.wrap(taskFun, { dropWhenReachLimit: true })
159+
160+
try {
161+
await fn1()
162+
} catch (err) {
163+
// when the concurrency limit is reached at this moment.
164+
// err.message is QueueIsFull
165+
console.log({ err })
166+
}
167+
```
156168

157169
### Decorators usage
158170

0 commit comments

Comments
 (0)