Socket
Socket
Sign inDemoInstall

p-queue

Package Overview
Dependencies
Maintainers
2
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

p-queue - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

25

index.js

@@ -58,2 +58,3 @@ 'use strict';

concurrency: Infinity,
autoStart: true,
queueClass: PriorityQueue

@@ -70,2 +71,3 @@ }, opts);

this._concurrency = opts.concurrency;
this._isPaused = opts.autoStart === false;
this._resolveEmpty = () => {};

@@ -78,3 +80,3 @@ this._resolveIdle = () => {};

if (this.queue.size > 0) {
if (!this._isPaused && this.queue.size > 0) {
this.queue.dequeue()();

@@ -107,3 +109,3 @@ } else {

if (this._pendingCount < this._concurrency) {
if (!this._isPaused && this._pendingCount < this._concurrency) {
run();

@@ -120,2 +122,17 @@ } else {

start() {
if (!this._isPaused) {
return;
}
this._isPaused = false;
while (this.queue.size > 0 && this._pendingCount < this._concurrency) {
this.queue.dequeue()();
}
}
pause() {
this._isPaused = true;
}
clear() {

@@ -162,4 +179,8 @@ this.queue = new this._queueClass(); // eslint-disable-line new-cap

}
get isPaused() {
return this._isPaused;
}
}
module.exports = PQueue;

2

package.json
{
"name": "p-queue",
"version": "2.2.0",
"version": "2.3.0",
"description": "Promise queue with concurrency control",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -57,2 +57,9 @@ # p-queue [![Build Status](https://travis-ci.org/sindresorhus/p-queue.svg?branch=master)](https://travis-ci.org/sindresorhus/p-queue)

##### autoStart
Type: `boolean`<br>
Default: `true`
Whether queue tasks within concurrency limit, are auto-executed as soon as they're added.
##### queueClass

@@ -93,2 +100,10 @@

#### .pause()
Put queue execution on hold.
#### .start()
Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)
#### .onEmpty()

@@ -118,3 +133,6 @@

#### .isPaused
Whether the queue is currently paused.
## Advanced example

@@ -121,0 +139,0 @@

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