Skip to content

Commit ab6e570

Browse files
committed
fix: handle properly small or zero tasksStealingRatio
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
1 parent 74970f2 commit ab6e570

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/pools/abstract-pool.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,8 +1848,9 @@ export abstract class AbstractPool<
18481848
if (
18491849
!workerNode.info.continuousStealing &&
18501850
(this.cannotStealTask() ||
1851+
this.opts.tasksQueueOptions?.tasksStealingRatio === 0 ||
18511852
(this.info.stealingWorkerNodes ?? 0) >
1852-
Math.round(
1853+
Math.ceil(
18531854
this.workerNodes.length *
18541855
this.opts.tasksQueueOptions!.tasksStealingRatio!,
18551856
))
@@ -1913,8 +1914,9 @@ export abstract class AbstractPool<
19131914
if (
19141915
this.cannotStealTask() ||
19151916
this.backPressure ||
1917+
this.opts.tasksQueueOptions?.tasksStealingRatio === 0 ||
19161918
(this.info.stealingWorkerNodes ?? 0) >
1917-
Math.round(
1919+
Math.ceil(
19181920
this.workerNodes.length *
19191921
this.opts.tasksQueueOptions!.tasksStealingRatio!,
19201922
)

0 commit comments

Comments
 (0)