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

fastq

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastq - npm Package Compare versions

Comparing version 1.4.1 to 1.5.0

10

package.json
{
"name": "fastq",
"version": "1.4.1",
"version": "1.5.0",
"description": "Fast, in memory work queue",

@@ -31,6 +31,6 @@ "main": "queue.js",

"devDependencies": {
"async": "^2.0.0-rc.3",
"neo-async": "^1.7.0",
"pre-commit": "^1.0.10",
"standard": "^6.0.0",
"async": "^2.1.0",
"neo-async": "^2.0.1",
"pre-commit": "^1.2.2",
"standard": "^8.6.0",
"tap-spec": "^4.0.0",

@@ -37,0 +37,0 @@ "tape": "^4.0.0"

@@ -30,3 +30,4 @@ 'use strict'

empty: noop,
kill: kill
kill: kill,
killAndDrain: killAndDrain
}

@@ -144,2 +145,9 @@

}
function killAndDrain () {
queueHead = null
queueTail = null
self.drain()
self.drain = noop
}
}

@@ -146,0 +154,0 @@

@@ -8,3 +8,3 @@ # fastq  [![build status](https://secure.travis-ci.org/mcollina/fastq.png)](http://travis-ci.org/mcollina/fastq)

* setImmedidate: 1359ms
* setImmediate: 1359ms
* fastq: 1492ms

@@ -78,2 +78,3 @@ * async.queue: 4039ms

* <a href="#kill"><code>queue#<b>kill()</b></code></a>
* <a href="#killAndDrain"><code>queue#<b>killAndDrain()</b></code></a>
* <a href="#concurrency"><code>queue#<b>concurrency</b></code></a>

@@ -146,2 +147,8 @@ * <a href="#drain"><code>queue#<b>drain</b></code></a>

-------------------------------------------------------
<a name="killAndDrain"></a>
### queue.killAndDrain()
Same than `kill` but the `drain` function will be called before reset to empty.
-------------------------------------------------------
<a name="concurrency"></a>

@@ -148,0 +155,0 @@ ### queue.concurrency

@@ -388,2 +388,37 @@ 'use strict'

test('killAndDrain', function (t) {
t.plan(6)
var queue = buildQueue(worker, 1)
var expected = [1]
var predrain = queue.drain
queue.drain = function drain () {
t.pass('drain has been called')
}
queue.push(1, done)
queue.push(4, done)
queue.unshift(3, done)
queue.unshift(2, done)
queue.killAndDrain()
function done (err, result) {
t.error(err, 'no error')
setImmediate(function () {
t.equal(queue.length(), 0, 'no queued tasks')
t.equal(queue.running(), 0, 'no running tasks')
t.equal(queue.drain, predrain, 'drain is back to default')
})
}
function worker (arg, cb) {
t.equal(expected.shift(), arg, 'tasks come in order')
setImmediate(function () {
cb(null, true)
})
}
})
test('pause && idle', function (t) {

@@ -390,0 +425,0 @@ t.plan(11)

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