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
9
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.0.2 to 2.1.0

16

index.js

@@ -24,2 +24,12 @@ var PROCESSING = 1;

Queue.prototype.concat = function(jobs) {
var self = this;
if (!jobs || jobs.constructor !== Array) {
throw new Error('jobs must be an Array');
}
for (var index = 0, length = jobs.length; index < length; index++) {
self.push(jobs[index]);
}
};
Queue.prototype.end = function(error) {

@@ -33,3 +43,3 @@ var self = this;

Queue.prototype.onData = function(data, end) {
Queue.prototype.onData = function(job, end) {
throw new Error('Queue.onData callback must be defined');

@@ -42,3 +52,3 @@ };

Queue.prototype.push = function(data) {
Queue.prototype.push = function(job) {
var self = this;

@@ -49,3 +59,3 @@ if (self._flags & EOF) {

if (self._flags & CLOSED_CLOSING) return;
self._array.push(data);
self._array.push(job);
self.pending++;

@@ -52,0 +62,0 @@ if (!(self._flags & PROCESSING)) self._process();

2

package.json
{
"name": "ronomon-queue",
"version": "2.0.2",
"version": "2.1.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",

# ronomon-queue
Process thousands of asynchronous or synchronous jobs, concurrently or sequentially, safely and efficiently, without creating thousands of closures.
Process thousands of asynchronous or synchronous jobs, concurrently or
sequentially, safely and efficiently, without creating thousands of closures.

@@ -50,12 +51,21 @@ ## Installation

* `job` A job which was pushed individually or pushed as part of an `Array` of jobs.
* `end` A callback for `onData()` to call when `onData()` has finished processing `job`.
* `job` A job which was pushed individually or pushed as part of an `Array` of
jobs.
* `end` A callback for `onData()` to call when `onData()` has finished
processing `job`.
A function which must be provided and which will be called once for each job. If an error is encountered while processing the job, this can be passed to the `end` callback to stop the queue and return an error to the `onEnd()` function.
A function which must be provided and which will be called once for each job. If
an error is encountered while processing the job, this can be passed to the
`end` callback to stop the queue and return an error to the `onEnd()` function.
**queue.onEnd = function([error]) {}**
* `error` An error encountered (if any) while pushing jobs onto the queue, or while processing jobs in the queue.
* `error` An error encountered (if any) while pushing jobs onto the queue, or
while processing jobs in the queue.
A function which must be provided and which will be called once `queue.end()` has been called and once all running and pending jobs in the queue complete. If an error is encountered, then `onEnd(error)` will be called as soon as all running jobs complete. If the queue is stopped using `stop()`, then `onEnd()` will be called as soon as all running jobs complete.
A function which must be provided and which will be called once `queue.end()`
has been called and once all running and pending jobs in the queue complete. If
an error is encountered, then `onEnd(error)` will be called as soon as all
running jobs complete. If the queue is stopped using `stop()`, then `onEnd()`
will be called as soon as all running jobs complete.

@@ -66,5 +76,12 @@ **queue.push(job)**

**queue.concat(jobs)**
* `jobs` An Array of jobs, each of which will be passed to the `onData()`
function.
**queue.end()**
Notify the queue that no further jobs will be pushed. The queue will wait for all running and all pending jobs to complete, and will then call the `onEnd()` function. `queue.end()` is idempotent, successive calls will be ignored.
Notify the queue that no further jobs will be pushed. The queue will wait for
all running and all pending jobs to complete, and will then call the `onEnd()`
function. `queue.end()` is idempotent, successive calls will be ignored.

@@ -75,11 +92,27 @@ **queue.end(error)**

Notify the queue that no further jobs will be pushed because an error was encountered while pushing jobs onto the queue. The queue will ignore any pending jobs, will wait for all running jobs to complete, and will then call the `onEnd()` function. The `onEnd()` function will be called with the same `error`, if no jobs return a different `error` before `queue.end(error)` is called. `queue.end(error)` is idempotent, successive calls will be ignored.
Notify the queue that no further jobs will be pushed because an error was
encountered while pushing jobs onto the queue. The queue will ignore any pending
jobs, will wait for all running jobs to complete, and will then call the
`onEnd()` function. The `onEnd()` function will be called with the same `error`,
if no jobs return a different `error` before `queue.end(error)` is called. `queue.end(error)` is idempotent, successive calls will be ignored.
**queue.stop([error])**
* `error` An error encountered while pushing jobs onto the queue, or while processing jobs in the queue.
* `error` An error encountered while pushing jobs onto the queue, or while
processing jobs in the queue.
An optional method to notify the queue that any pending jobs should be ignored. The queue will ignore any pending jobs, will wait for all running jobs to complete, and will then call the `onEnd()` function. If no `error` argument is provided, then the `onEnd()` function will be called without an `error`, provided no jobs return an `error` before `stop()` is called (if any running jobs return an `error` after `stop()` is called, their errors will be ignored). `stop()` is idempotent, successive calls will be ignored.
An optional method to notify the queue that any pending jobs should be ignored.
The queue will ignore any pending jobs, will wait for all running jobs to
complete, and will then call the `onEnd()` function. If no `error` argument is
provided, then the `onEnd()` function will be called without an `error`,
provided no jobs return an `error` before `stop()` is called (if any running
jobs return an `error` after `stop()` is called, their errors will be
ignored). `stop()` is idempotent, successive calls will be ignored.
There are several differences between `stop()` and `queue.end()`. `stop()` will ignore any pending jobs, whereas `queue.end()` will wait for all pending jobs to complete before calling the `onEnd()` function. A successive call to `queue.end(error)` will be ignored if `queue.end()` has already been called, whereas `stop(error)` will stop the queue even if `queue.end()` has already been called.
There are several differences between `stop()` and `queue.end()`. `stop()` will
ignore any pending jobs, whereas `queue.end()` will wait for all pending jobs to
complete before calling the `onEnd()` function. A successive call to
`queue.end(error)` will be ignored if `queue.end()` has already been called,
whereas `stop(error)` will stop the queue even if `queue.end()` has already been
called.

@@ -86,0 +119,0 @@ ## Tests

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