1.1.4 • Published 3 years ago

fishqueue v1.1.4

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

fishqueue

Unit Tests Codecov

High-velocity queue for handling incoming Express.js requests across replicated codebase using Redis with minimal residue and maximum buzzwords

Install

yarn add fishqueue

Usage

import Queue from 'fishqueue'

const queue = new Queue('webhook', { redis: process.env.REDIS_URI, concurrency: 3 })

app.post('/webhook', queue.process(async (req, res) => {
  const result = await handleWebHook(req.body)

  res.send(result)
}))

Configuration

Pass an object containing the following properties into the second constructor argument of Queue:

PropertyDescriptionRequired?Defaults To
redisA Redis connection object or URI (see here for more details)nonull
verboseA boolean stating if fishqueue should provide detail logsnofalse
concurrencyA number stating the amount of concurrent requests to be handled in accordance with concurrencyTypeno3
concurrencyTypeA string stating the type of concurrency which should be used. See Concurrency Types for more infononode

Concurrency Types

TypeDescription
nodeEach instance of your app can handle {{ concurrency }} requests at a time. For example, a cluster of 3 nodes with a concurrency of 6 will handle 6 requests per node, totalling 18 requests in processing at any given time
clusterRequests will be handled in a distributed fashion. For example, a cluster of 3 nodes with a concurrency of 6 will handle 2 requests per node
Visual Examples
NodeClusterbeta

License

Do No Harm