fix: initialize attribute in the constructor
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 10 Mar 2023 20:24:41 +0000 (21:24 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 10 Mar 2023 20:24:41 +0000 (21:24 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/pools/selection-strategies/abstract-worker-choice-strategy.ts

index 314c13c0cd02063a569a8ee5997a1d748b13cdbd..ebe74dcb07543b7c7698e2c2f284c33893b6e9ca 100644 (file)
@@ -19,7 +19,7 @@ export abstract class AbstractWorkerChoiceStrategy<
   Response
 > implements IWorkerChoiceStrategy<Worker> {
   /** {@inheritDoc} */
-  public readonly isDynamicPool: boolean = this.pool.type === PoolType.DYNAMIC
+  public readonly isDynamicPool: boolean
   /** {@inheritDoc} */
   public requiredStatistics: RequiredStatistics = {
     runTime: false
@@ -32,7 +32,9 @@ export abstract class AbstractWorkerChoiceStrategy<
    */
   public constructor (
     protected readonly pool: IPoolInternal<Worker, Data, Response>
-  ) {}
+  ) {
+    this.isDynamicPool = this.pool.type === PoolType.DYNAMIC
+  }
 
   /** {@inheritDoc} */
   public abstract reset (): boolean