sidequest
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-a3 • Public • Published

sidequest

Sidequest is simple background processor for node.js

It's the first task scheduler that you may add to your web application project with safety, by using child process or running on backgroun it wont block the main process, even with if the task use blocking io.

Usage

Tree steps to background tasks 🚀

    1. Install sidequest dependency
npm install --save sidequest
    1. Create a task class
const { Task } = require('sidequest');

class MyJob extends Task {
  run(foo, bar){
    console.log(foo, bar);
  }
}

module.exports = MyJob;
    1. Create the sidequest-config.json and register your queues and tasks:
{
  "queues": [
    {
      "name": "high",
      "workers": 10
    },
    {
      "name": "default",
      "workers": 2
    }
  ],
  "tasks": [
    {
      "name": "MyJob",
      "path": "./playground/my-job.js",
      "queue": "high"
    }
  ]
}
    1. Initialize sidequest in you app:
    const sidequest = require('sidequest');
    
    // ...
    sidequest.start();
    // ...
  • Alternative: Start sidequest by command line:
$ npm install -g sidequest
$ sidequest 

/sidequest/

    Package Sidebar

    Install

    npm i sidequest

    Weekly Downloads

    0

    Version

    1.0.0-a3

    License

    ISC

    Unpacked Size

    66.6 kB

    Total Files

    54

    Last publish

    Collaborators

    • merencia