Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ronomon/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

@ronomon/queue - npm Package Compare versions

Comparing version 2.1.0 to 3.0.0

8

index.js

@@ -13,3 +13,3 @@ var PROCESSING = 1;

self.concurrency = Queue.parseConcurrency(concurrency);
self.pending = 0;
self.length = 0;
self.running = 0;

@@ -58,3 +58,3 @@ self.error = undefined;

self._array.push(job);
self.pending++;
self.length++;
if (!(self._flags & PROCESSING)) self._process();

@@ -78,3 +78,3 @@ };

}
self.pending--;
self.length--;
self.running--;

@@ -124,3 +124,3 @@ self._tick(error);

}
if ((self._flags & EOF) && self.pending === 0) {
if ((self._flags & EOF) && self.length === 0) {
if (self.running !== 0) {

@@ -127,0 +127,0 @@ throw new Error('running=' + self.running + ' !== 0');

{
"name": "@ronomon/queue",
"version": "2.1.0",
"version": "3.0.0",
"description": "Process thousands of asynchronous or synchronous jobs, concurrently or sequentially, safely and efficiently, without creating thousands of closures.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -50,3 +50,3 @@ var Queue = require('./index.js');

var running = 0;
var pending = 0;
var length = 0;
var closed = false;

@@ -77,4 +77,4 @@ var closing = false;

}
if (queue.pending !== pending) {
throw new Error('queue.pending=' + queue.pending + ' !== ' + pending);
if (queue.length !== length) {
throw new Error('queue.length=' + queue.length + ' !== ' + length);
}

@@ -109,3 +109,3 @@ if (queue.running !== running) {

running--;
pending--;
length--;
if (random() < 0.01) {

@@ -148,3 +148,3 @@ closing = true;

' concurrency=' + pad(queue.concurrency, 4) +
' pending=' + pad(pending, 4) +
' length=' + pad(length, 4) +
' running=' + pad(running, 4)

@@ -197,16 +197,16 @@ );

}
var completed = pushed - pending;
var completed = pushed - length;
if (Object.keys(stopped).length !== completed) {
console.log('queue.running=' + queue.running);
console.log('queue.pending=' + queue.pending);
console.log('queue.length=' + queue.length);
console.log('stopped=' + Object.keys(stopped).join(','));
throw new Error(
'onEnd stopped=' + Object.keys(stopped).length +
' !== (pushed=' + pushed + ' - pending=' + pending + ')=' +
(pushed - pending)
' !== (pushed=' + pushed + ' - length=' + length + ')=' +
(pushed - length)
);
}
if (!closing) {
if (pending !== 0) {
throw new Error('onEnd pending=' + pending + ' !== 0');
if (length !== 0) {
throw new Error('onEnd length=' + length + ' !== 0');
}

@@ -219,3 +219,3 @@ }

' concurrency=' + pad(queue.concurrency, 4) +
' pending=' + pad(pending, 4) +
' length=' + pad(length, 4) +
' running=' + pad(running, 4) +

@@ -241,7 +241,7 @@ (error ? ' error=' + error : ' success')

pushed++;
pending++;
length++;
}
queue.push(jobs.shift());
if (!closing && queue.running === 0 && queue.pending === pushed && pushed > 0) {
console.log('pending=' + pending);
if (!closing && queue.running === 0 && queue.length === pushed && pushed > 0) {
console.log('length=' + length);
console.log('pushed=' + pushed);

@@ -248,0 +248,0 @@ console.log(queue);

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