X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fabstract-pool.ts;h=9f7813e74cd7bd2579081ef9fd83facef0c59fdf;hb=7d3ed70ed3ebb6a3656041db3c6ea23a1f354616;hp=1237491b94df3dc62bc79a056bed64bb9643edd4;hpb=c4855468bc26a7ee37d2c8ef34bb1ac864448e77;p=poolifier.git diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 1237491b..9f7813e7 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -27,7 +27,7 @@ import { CircularArray } from '../circular-array' * * @typeParam Worker - Type of worker which manages this pool. * @typeParam Data - Type of data sent to the worker. This can only be serializable data. - * @typeParam Response - Type of response of execution. This can only be serializable data. + * @typeParam Response - Type of execution response. This can only be serializable data. */ export abstract class AbstractPool< Worker extends IWorker, @@ -227,11 +227,19 @@ export abstract class AbstractPool< ) } - /** @inheritDoc */ - public abstract get full (): boolean + /** + * Whether the pool is full or not. + * + * The pool filling boolean status. + */ + protected abstract get full (): boolean - /** @inheritDoc */ - public abstract get busy (): boolean + /** + * Whether the pool is busy or not. + * + * The pool busyness boolean status. + */ + protected abstract get busy (): boolean protected internalBusy (): boolean { return this.findFreeWorkerNodeKey() === -1 @@ -253,7 +261,7 @@ export abstract class AbstractPool< id: crypto.randomUUID() } const res = new Promise((resolve, reject) => { - this.promiseResponseMap.set(submittedTask.id, { + this.promiseResponseMap.set(submittedTask.id as string, { resolve, reject, worker: workerNode.worker