'use strict'
const FixedThreadPool = require('./fixed')
-const { randomWorker } = require('./util')
const EventEmitter = require('events')
class MyEmitter extends EventEmitter {}
*
* @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)
} 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()