X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=lib%2Fdynamic.js;h=36db0c75673ed7a70d4fe5e6e634b2754c38529f;hb=34a572ebf9c071ffb2f5b1efefd6784d84170138;hp=e5a9c690b95a27bf161519cd7a6840ef01242bcf;hpb=766e51a0c50e4aadad5f8c65a2b6689d91ba75d8;p=poolifier.git diff --git a/lib/dynamic.js b/lib/dynamic.js index e5a9c690..36db0c75 100644 --- a/lib/dynamic.js +++ b/lib/dynamic.js @@ -1,6 +1,5 @@ 'use strict' const FixedThreadPool = require('./fixed') -const { randomWorker } = require('./util') const EventEmitter = require('events') class MyEmitter extends EventEmitter {} @@ -16,7 +15,6 @@ class DynamicThreadPool extends FixedThreadPool { * * @param {Number} min Min number of threads that will be always active * @param {Number} max Max number of threads that will be active - * @param {Object} an object with possible options for example maxConcurrency */ constructor (min, max, filename, opts) { super(min, filename, opts) @@ -39,7 +37,7 @@ class DynamicThreadPool extends FixedThreadPool { } else { if (this.workers.length === this.max) { this.emitter.emit('FullPool') - return randomWorker(this.tasks) + return super._chooseWorker() } // all workers are busy create a new worker const worker = this._newWorker()