coopernurse / node-pool

Generic resource pooling for node.js
2.37k stars 259 forks source link

autostart/ pool.start do not initialise the min amount of instances #211

Closed gajus closed 6 years ago

gajus commented 6 years ago
const {createPool} = require('generic-pool');

const pool = createPool({
  create: () => {
    console.log('start');

    return {};
  },
  max: Infinity,
  min: 5
});

pool.start();

I expect this to print "start" 5 times when executed.

gajus commented 6 years ago

Oh, the options is a second parameter.

const {createPool} = require('generic-pool');

const pool = createPool({
  create: () => {
    console.log('start');

    return {};
  }
}, {
  max: Infinity,
  min: 5
});

pool.start();

Please use parameter validation (e.g. https://github.com/webpack/webpack/issues/2971).