We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3652b0b + adbcc31 commit 0612ae8Copy full SHA for 0612ae8
packages/utility/asynchronous/src/concurrency/weightedRequestsConcurrencyController.ts
@@ -53,6 +53,13 @@ export const weightedRequestConcurrencyController = (
53
}
54
55
const runJob = async <T>(job: Job<T>, concurrency: number): Promise<T> => {
56
+ if (concurrency < 0) {
57
+ throw new Error('Concurrency must be greater than 0')
58
+ }
59
+ if (concurrency > maxConcurrency) {
60
+ throw new Error('Concurrency must be less than or equal to max concurrency')
61
62
+
63
const exceededMaxConcurrency = active + concurrency > maxConcurrency
64
const shouldRespectOrder = ensureOrder && queue.length > 0
65
if (exceededMaxConcurrency || shouldRespectOrder) {
0 commit comments