Socket
Socket
Sign inDemoInstall

seq-queue

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

seq-queue

A simple tool to keep requests to be executed in order.


Version published
Weekly downloads
2.5M
increased by0.21%
Maintainers
1
Weekly downloads
 
Created

What is seq-queue?

The seq-queue npm package provides a mechanism to manage and execute tasks sequentially. It ensures that tasks are processed one at a time in the order they were added, which is useful for scenarios where tasks need to be executed in a specific sequence to avoid race conditions or ensure data consistency.

What are seq-queue's main functionalities?

Creating a Queue

This feature allows you to create a new sequential queue instance. The queue will manage tasks and ensure they are executed one at a time in the order they were added.

const seqqueue = require('seq-queue');
const queue = seqqueue.createQueue();

Adding Tasks to the Queue

This feature allows you to add tasks to the queue. Each task is a function that receives a task object, which must call the `done` method when the task is complete. This ensures the next task in the queue can be executed.

queue.push(function(task) {
  console.log('Task 1 executed');
  task.done();
});

queue.push(function(task) {
  console.log('Task 2 executed');
  task.done();
});

Handling Task Timeouts

This feature allows you to specify a timeout for each task. If the task does not call `done` within the specified timeout, it will be considered failed, and the next task in the queue will be executed.

queue.push(function(task) {
  setTimeout(function() {
    console.log('Task 3 executed');
    task.done();
  }, 1000);
}, 500);

Other packages similar to seq-queue

FAQs

Package last updated on 20 Nov 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc