const Piscina = require('piscina');
const PiscinaPriorityQueue = require('piscina-priority-queue');
const { resolve } = require('path');
const pool = new Piscina({
filename: resolve(__dirname, 'worker.js'),
taskQueue; new PiscinaPriorityQueue()
});
const priority_1_task = PiscinaPriorityQueue.makeTask({ a: 1 }, 1);
const priority_2_task = PiscinaPriorityQueue.makeTask({ a: 1 }, 2);
(async () => {
await Promise.all([
pool.runTask(priority_1_task),
pool.runTask(priority_2_task)
]);
})();
- James M Snell [email protected]
- Anna Henningsen [email protected]
- Matteo Collina [email protected]
Piscina development is sponsored by NearForm Research.