0.0.3 • Published 3 years ago

local-queue v0.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

local-queue

简体中文

Introduction

A simple local-queue based on memory which suits simple single instance project.

If replicas interest you,consider bull based on redis.(Or a package based on bull?)

Usage

Installation

npm install local-queue

Example

const Lq = require('local-queue')
const processor = async (data) => {
  // Customized function
}
const lq = new Lq(processor) // Init queue instance

lq.add('testdata1') // Add jobs for the queue by this add function.Param here will pass to processor later.
lq.add('testdata2')
lq.add('testdata3')

// lq.close() // Close the queue.Not recommended since I can't imagine the situation.Potential problems might happen.