X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fpools%2Fabstract-pool.ts;h=604c7af8ad32dde3959dcb75166427458999c9f7;hb=4ef0b45781a9a2a1416c4bb62d700a0c70e71145;hp=00cf56171f181184ff93fe9f24b4a107af188fee;hpb=51d9cfbdf05e27031dc74dcdfd0b060dbc4c716e;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() } }