Skip to content

Commit

Permalink
fix: handle properly small or zero tasksStealingRatio
Browse files Browse the repository at this point in the history
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
  • Loading branch information
jerome-benoit committed Aug 30, 2024
1 parent 74970f2 commit ab6e570
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pools/abstract-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1848,8 +1848,9 @@ export abstract class AbstractPool<
if (
!workerNode.info.continuousStealing &&
(this.cannotStealTask() ||
this.opts.tasksQueueOptions?.tasksStealingRatio === 0 ||
(this.info.stealingWorkerNodes ?? 0) >
Math.round(
Math.ceil(
this.workerNodes.length *
this.opts.tasksQueueOptions!.tasksStealingRatio!,
))
Expand Down Expand Up @@ -1913,8 +1914,9 @@ export abstract class AbstractPool<
if (
this.cannotStealTask() ||
this.backPressure ||
this.opts.tasksQueueOptions?.tasksStealingRatio === 0 ||
(this.info.stealingWorkerNodes ?? 0) >
Math.round(
Math.ceil(
this.workerNodes.length *
this.opts.tasksQueueOptions!.tasksStealingRatio!,
)
Expand Down

0 comments on commit ab6e570

Please sign in to comment.