Skip to content

piscinajs/piscina-priority-queue

Repository files navigation

piscina-priority-queue - A Priority Queue for Piscina

CI

Example

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)
  ]);
})();

The Team

Acknowledgements

Piscina development is sponsored by NearForm Research.