X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fpools%2Fselection-strategies%2Fless-busy-worker-choice-strategy.ts;h=87ef804d50881f157e2810a715c2db4627315f33;hb=aee467366d8c393b79e7af82c6a7ab12338ee64e;hp=75109a2b2848af781704a0c41965cf7180ea27e7;hpb=bf90656cacf88d2cfdd5b3262086ba55b2ff9818;p=poolifier.git diff --git a/src/pools/selection-strategies/less-busy-worker-choice-strategy.ts b/src/pools/selection-strategies/less-busy-worker-choice-strategy.ts index 75109a2b..87ef804d 100644 --- a/src/pools/selection-strategies/less-busy-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/less-busy-worker-choice-strategy.ts @@ -14,25 +14,26 @@ import type { */ export class LessBusyWorkerChoiceStrategy< Worker extends IPoolWorker, - Data, - Response + Data = unknown, + Response = unknown > extends AbstractWorkerChoiceStrategy implements IWorkerChoiceStrategy { - /** {@inheritDoc} */ + /** @inheritDoc */ public readonly requiredStatistics: RequiredStatistics = { - runTime: true + runTime: true, + avgRunTime: false } - /** {@inheritDoc} */ + /** @inheritDoc */ public reset (): boolean { return true } - /** {@inheritDoc} */ + /** @inheritDoc */ public choose (): number { const freeWorkerKey = this.pool.findFreeWorkerKey() - if (!this.isDynamicPool && freeWorkerKey !== -1) { + if (freeWorkerKey !== -1) { return freeWorkerKey } let minRunTime = Infinity @@ -49,7 +50,7 @@ export class LessBusyWorkerChoiceStrategy< return lessBusyWorkerKey } - /** {@inheritDoc} */ + /** @inheritDoc */ public remove (workerKey: number): boolean { return true }