Comparing version 1.3.0 to 1.4.0
11
bench.js
@@ -6,3 +6,5 @@ 'use strict' | ||
var async = require('async') | ||
var neo = require('neo-async') | ||
var asyncqueue = async.queue(worker, 1) | ||
var neoqueue = neo.queue(worker, 1) | ||
@@ -28,3 +30,3 @@ function bench (func, done) { | ||
function benchFastQueue (done) { | ||
function benchFastQ (done) { | ||
fastqueue.push(42, done) | ||
@@ -37,2 +39,6 @@ } | ||
function benchNeoQueue (done) { | ||
neoqueue.push(42, done) | ||
} | ||
function worker (arg, cb) { | ||
@@ -49,3 +55,4 @@ setImmediate(cb) | ||
benchSetImmediate, | ||
benchFastQueue, | ||
benchFastQ, | ||
benchNeoQueue, | ||
benchAsyncQueue | ||
@@ -52,0 +59,0 @@ ], bench, done) |
{ | ||
"name": "fastq", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Fast, in memory work queue", | ||
@@ -31,5 +31,6 @@ "main": "queue.js", | ||
"devDependencies": { | ||
"async": "^1.2.1", | ||
"async": "^2.0.0-rc.3", | ||
"neo-async": "^1.7.0", | ||
"pre-commit": "^1.0.10", | ||
"standard": "^5.2.0", | ||
"standard": "^6.0.0", | ||
"tap-spec": "^4.0.0", | ||
@@ -36,0 +37,0 @@ "tape": "^4.0.0" |
@@ -65,3 +65,3 @@ 'use strict' | ||
function idle () { | ||
return _running === 0 | ||
return _running === 0 && self.length() === 0 | ||
} | ||
@@ -68,0 +68,0 @@ |
@@ -8,5 +8,6 @@ # fastq [![build status](https://secure.travis-ci.org/mcollina/fastq.png)](http://travis-ci.org/mcollina/fastq) | ||
* setImmedidate: 1313ms | ||
* fastq: 1462ms | ||
* async.queue: 3989ms | ||
* setImmedidate: 1359ms | ||
* fastq: 1492ms | ||
* async.queue: 4039ms | ||
* neoAsync.queue: 4476ms | ||
@@ -13,0 +14,0 @@ Obtained on node 4.2.2, on a MacBook Pro 2014 (i7, 16GB of RAM). |
35
test.js
@@ -387,1 +387,36 @@ 'use strict' | ||
}) | ||
test('pause && idle', function (t) { | ||
t.plan(11) | ||
var queue = buildQueue(worker, 1) | ||
var worked = false | ||
t.notOk(queue.paused, 'it should not be paused') | ||
t.ok(queue.idle(), 'should be idle') | ||
queue.pause() | ||
queue.push(42, function (err, result) { | ||
t.error(err, 'no error') | ||
t.equal(result, true, 'result matches') | ||
}) | ||
t.notOk(worked, 'it should be paused') | ||
t.ok(queue.paused, 'it should be paused') | ||
t.notOk(queue.idle(), 'should not be idle') | ||
queue.resume() | ||
t.notOk(queue.paused, 'it should not be paused') | ||
t.notOk(queue.idle(), 'it should not be idle') | ||
function worker (arg, cb) { | ||
t.equal(arg, 42) | ||
worked = true | ||
process.nextTick(cb.bind(null, null, true)) | ||
process.nextTick(function () { | ||
t.ok(queue.idle(), 'is should be idle') | ||
}) | ||
} | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19479
515
177
6