X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fdynamic-pool-worker-choice-strategy.ts;h=9b4b6ddeeaa2c520ef2252c9e47ac0b061f5a4fa;hb=daa307e54545706359aff24ef409a73eac4a4c11;hp=731bb91b4b0fad58d7ea40fb9511ada5b538b17e;hpb=ea7a90d36354a4e1c833271571c6f3eb80428600;p=poolifier.git diff --git a/src/pools/selection-strategies/dynamic-pool-worker-choice-strategy.ts b/src/pools/selection-strategies/dynamic-pool-worker-choice-strategy.ts index 731bb91b..9b4b6dde 100644 --- a/src/pools/selection-strategies/dynamic-pool-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/dynamic-pool-worker-choice-strategy.ts @@ -9,7 +9,7 @@ import { WorkerChoiceStrategies } from './selection-strategies-types' import { SelectionStrategiesUtils } from './selection-strategies-utils' /** - * Dynamically choose a worker. + * Selects the next worker for dynamic pool. * * @template Worker Type of worker which manages the strategy. * @template Data Type of data sent to the worker. This can only be serializable data. @@ -23,7 +23,7 @@ export class DynamicPoolWorkerChoiceStrategy< private workerChoiceStrategy: IWorkerChoiceStrategy /** - * Constructs a worker choice strategy for dynamical pool. + * Constructs a worker choice strategy for dynamic pool. * * @param pool The pool instance. * @param createDynamicallyWorkerCallback The worker creation callback for dynamic pool. @@ -31,7 +31,7 @@ export class DynamicPoolWorkerChoiceStrategy< */ public constructor ( pool: IPoolInternal, - private createDynamicallyWorkerCallback: () => Worker, + private readonly createDynamicallyWorkerCallback: () => Worker, workerChoiceStrategy: WorkerChoiceStrategy = WorkerChoiceStrategies.ROUND_ROBIN ) { super(pool) @@ -43,8 +43,8 @@ export class DynamicPoolWorkerChoiceStrategy< } /** @inheritDoc */ - public resetStatistics (): boolean { - return this.workerChoiceStrategy.resetStatistics() + public reset (): boolean { + return this.workerChoiceStrategy.reset() } /** @inheritDoc */ @@ -54,7 +54,7 @@ export class DynamicPoolWorkerChoiceStrategy< return freeWorker } - if (this.pool.busy) { + if (this.pool.busy === true) { return this.workerChoiceStrategy.choose() }