Create pool to limit the preemption of resource.
npm
npm install @konper/easy-pool
yarn
yarn add @konper/easy-pool
const foo = (cb) => {
// touch resource here
// ...
// done
cb()
}
const pool = new Pool([size = 5])
pool.push(foo)
pool.on(event, callback)
done
: triggered when size became 0.