Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
}
private tasksStealingOnBackPressure (workerId: number): void {
- if ((this.opts.tasksQueueOptions?.size as number) <= 1) {
+ const sizeOffset = 1
+ if ((this.opts.tasksQueueOptions?.size as number) <= sizeOffset) {
return
}
const sourceWorkerNode =
workerNode.info.ready &&
workerNode.info.id !== workerId &&
workerNode.usage.tasks.queued <
- (this.opts.tasksQueueOptions?.size as number) - 1
+ (this.opts.tasksQueueOptions?.size as number) - sizeOffset
) {
const task = {
...(sourceWorkerNode.popTask() as Task<Data>),