1.0.13 • Published 6 years ago

zomato-queue v1.0.13

Weekly downloads
3
License
ISC
Repository
github
Last release
6 years ago

A simple job/task queue

  • Add logs url
  • Add simple get requests.

Introduction

  • npm install zomato-queue;
import Queue from "zomato-queue";

let options = {
  name: "example",
  concurrency: 3,
  async: true
};

let task = new Queue(options);

here we pass options object with :

  • name
  • concurrency (should be > 2)
  • async (true/false)
for (let i = 0; i < 20; i++) {
  let dataOptions = {
    startQueue: true,
    taskType: "url",
    data: "https://httpbin.org/post",
    method: "POST",
    payload: { tittle: "tittle", body: "body" }
  };

  task.createJob(dataOptions);

dataOptions object accepts:

  • startQueue: if task should start processing after adding or not. (true/false).
  • taskType: currently supports url or function. (in strings)
  • data: if taskType is url, data should be a string comprising of a https url. If function then the function itseld.
  • method: supports POST for now. leave blank if taskType is function.
  • payload: if method is POST else empty.
task.runAllTasks();
  • this will run all tasks present in queue. If startQueue was false then queue would have all tasks.

open console to see output.

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago