X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=README.md;h=e7b7a5d1f75a3ad6e90927ed1a2efe3441136a04;hb=2d222913a09a96b2a78b0c2072ddff98973a35a5;hp=affe8bc91ce03bc3ad3f6c71448203026ee40eaa;hpb=4e91d15cbefe6a0f865663201dad80d25276ba16;p=poolifier.git diff --git a/README.md b/README.md index affe8bc9..e7b7a5d1 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Please consult our [general guidelines](#general-guidelines). - Tasks distribution strategies :white_check_mark: - Lockless tasks queueing :white_check_mark: - Queued tasks rescheduling: - - Task stealing :white_check_mark: + - Task stealing on empty queue :white_check_mark: - Tasks stealing under back pressure :white_check_mark: - Tasks redistribution on worker error :white_check_mark: - General guidelines on pool choice :white_check_mark: @@ -116,8 +116,8 @@ const pool = new FixedThreadPool(availableParallelism(), './yourWorker.js', { onlineHandler: () => console.info('worker is online') }) -pool.emitter.on(PoolEvents.ready, () => console.info('Pool is ready')) -pool.emitter.on(PoolEvents.busy, () => console.info('Pool is busy')) +pool.emitter?.on(PoolEvents.ready, () => console.info('Pool is ready')) +pool.emitter?.on(PoolEvents.busy, () => console.info('Pool is busy')) // or a dynamic worker_threads pool const pool = new DynamicThreadPool(Math.floor(availableParallelism() / 2), availableParallelism(), './yourWorker.js', { @@ -125,9 +125,9 @@ const pool = new DynamicThreadPool(Math.floor(availableParallelism() / 2), avail onlineHandler: () => console.info('worker is online') }) -pool.emitter.on(PoolEvents.full, () => console.info('Pool is full')) -pool.emitter.on(PoolEvents.ready, () => console.info('Pool is ready')) -pool.emitter.on(PoolEvents.busy, () => console.info('Pool is busy')) +pool.emitter?.on(PoolEvents.full, () => console.info('Pool is full')) +pool.emitter?.on(PoolEvents.ready, () => console.info('Pool is ready')) +pool.emitter?.on(PoolEvents.busy, () => console.info('Pool is busy')) // the execute method signature is the same for both implementations, // so you can easily switch from one to another