You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+133Lines changed: 133 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -367,6 +367,68 @@ Whether the queue is currently paused.
367
367
368
368
Whether the queue is currently rate-limited due to `intervalCap`. Returns `true` when the number of tasks executed in the current interval has reached the `intervalCap` and there are still tasks waiting to be processed.
369
369
370
+
#### .isSaturated
371
+
372
+
Whether the queue is saturated. Returns `true` when:
373
+
- All concurrency slots are occupied and tasks are waiting, OR
374
+
- The queue is rate-limited and tasks are waiting
375
+
376
+
Useful for detecting backpressure and potential hanging tasks.
377
+
378
+
```js
379
+
importPQueuefrom'p-queue';
380
+
381
+
constqueue=newPQueue({concurrency:2});
382
+
383
+
// Backpressure handling
384
+
if (queue.isSaturated) {
385
+
console.log('Queue is saturated, waiting for capacity...');
@@ -739,6 +801,77 @@ for await (const result of pMapIterable(
739
801
}
740
802
```
741
803
804
+
#### How do I debug a queue that stops processing tasks?
805
+
806
+
If your queue stops processing tasks after extended use, it's likely that some tasks are hanging indefinitely, exhausting the concurrency limit. Use the `.runningTasks` property to identify which specific tasks are stuck.
0 commit comments