X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fabstract-pool.ts;h=604c7af8ad32dde3959dcb75166427458999c9f7;hb=16ce27f3d5276072eb9f4633dd70c1e46ba6a868;hp=00cf56171f181184ff93fe9f24b4a107af188fee;hpb=0cf6d1374ad842cc31aca1a8ddaa1bc5a9b9302b;p=poolifier.git diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 00cf5617..604c7af8 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -17,6 +17,7 @@ import { max, median, min, + once, round } from '../utils' import { KillBehaviors } from '../worker/worker-options' @@ -1542,7 +1543,11 @@ export abstract class AbstractPool< workerInfo.ready = message.ready as boolean workerInfo.taskFunctionNames = message.taskFunctionNames if (this.ready) { - this.emitter?.emit(PoolEvents.ready, this.info) + const emitPoolReadyEventOnce = once( + () => this.emitter?.emit(PoolEvents.ready, this.info), + this + ) + emitPoolReadyEventOnce() } }