1432
// Check for reaching maximum of pending work
1433
if (typeof this.options.maxBufferedWork === 'number') {
1435
>
// Throttled: simple check if pending + units exceeds max pending
1436
>
if (this.throttler.value) {
1437
if (this.pending + units.length > this.options.maxBufferedWork) {
1438
return false; // work not accepted: too much pending work
1439
}
1440
}
1442
>
// Unthrottled: same as throttled, but account for max chunk getting
1443
>
// worked on directly without being pending
1444
>
else {
1445
>
if (this.pending + units.length - this.options.maxWorkChunkSize > this.options.maxBufferedWork) {
1446
return false; // work not accepted: too much pending work
1447
}
1449
>
}
1450
1451
// Add to pending units first