X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=README.md;h=53ea832dffd985bd05f8d714370be03c994e71f7;hb=a97f9c80aa49c6152547fb6fa8de4b0f089c2353;hp=ee40061d62060a17159ce4a3bf2953adb956db61;hpb=77492f2e943e5ca2922e36c345816168298e8090;p=poolifier.git diff --git a/README.md b/README.md index ee40061d..53ea832d 100644 --- a/README.md +++ b/README.md @@ -114,10 +114,10 @@ Instantiate your pool based on your needs : ```js 'use strict' -const { DynamicThreadPool, FixedThreadPool, PoolEvents } = require('poolifier') +const { DynamicThreadPool, FixedThreadPool, PoolEvents, availableParallelism } = require('poolifier') // a fixed worker-threads pool -const pool = new FixedThreadPool(15, './yourWorker.js', { +const pool = new FixedThreadPool(availableParallelism(), './yourWorker.js', { errorHandler: e => console.error(e), onlineHandler: () => console.info('worker is online') }) @@ -125,7 +125,7 @@ const pool = new FixedThreadPool(15, './yourWorker.js', { pool.emitter.on(PoolEvents.busy, () => console.info('Pool is busy')) // or a dynamic worker-threads pool -const pool = new DynamicThreadPool(10, 100, './yourWorker.js', { +const pool = new DynamicThreadPool(availableParallelism() / 2, availableParallelism(), './yourWorker.js', { errorHandler: e => console.error(e), onlineHandler: () => console.info('worker is online') })