Comparing version 3.0.6 to 3.0.7
@@ -119,3 +119,3 @@ var inherits = require('inherits'); | ||
Queue.prototype.end = function(err) { | ||
this.jobs = []; | ||
this.jobs.length = 0; | ||
this.pending = 0; | ||
@@ -122,0 +122,0 @@ done.call(this, err); |
{ | ||
"name": "queue", | ||
"version": "3.0.6", | ||
"version": "3.0.7", | ||
"description": "asynchronous function queue with adjustable concurrency", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -109,3 +109,3 @@ ``` | ||
#### `q.start([cb])` | ||
cb, if passed will be called when the queue empties. | ||
cb, if passed, will be called when the queue empties or when an error occurs. | ||
@@ -168,3 +168,4 @@ #### `q.stop()` | ||
This work is free. You can redistribute it and/or modify it under the | ||
terms of the [WTFPL](http://www.wtfpl.net/txt/copying), | ||
as published by Sam Hocevar. See http://www.wtfpl.net for more details. | ||
terms of the [WTFPL](http://www.wtfpl.net/txt/copying). | ||
No Warranty. The Software is provided "as is" without warranty of any kind, either express or implied, including without limitation any implied warranties of condition, uninterrupted use, merchantability, fitness for a particular purpose, or non-infringement. |
@@ -8,15 +8,4 @@ var tape = require('tape'); | ||
var actual = []; | ||
var q = queue({ concurrency: 100 }); | ||
q.on('end', function() { | ||
var expected = [ 'one', 'two', 'three' ]; | ||
t.equal(actual.length, expected.length); | ||
var q = queue(); | ||
for (var i in actual) { | ||
var a = actual[i]; | ||
var e = expected[i]; | ||
t.equal(a, e); | ||
} | ||
}); | ||
q.push(function(cb) { | ||
@@ -26,3 +15,3 @@ setTimeout(function() { | ||
cb(); | ||
}, 10); | ||
}, 0); | ||
}); | ||
@@ -34,3 +23,3 @@ | ||
cb(); | ||
}, 30); | ||
}, 200); | ||
}); | ||
@@ -42,6 +31,15 @@ | ||
cb(); | ||
}, 20); | ||
}, 100); | ||
}); | ||
q.start(); | ||
q.start(function() { | ||
var expected = [ 'one', 'two', 'three' ]; | ||
t.equal(actual.length, expected.length); | ||
for (var i in actual) { | ||
var a = actual[i]; | ||
var e = expected[i]; | ||
t.equal(a, e); | ||
} | ||
}); | ||
}); |
@@ -9,14 +9,4 @@ var tape = require('tape'); | ||
q.on('end', function(err) { | ||
t.equal(q.length, 0); | ||
if (err) { | ||
q.push(function(cb) { | ||
setTimeout(cb, 5); | ||
}); | ||
} | ||
}); | ||
q.push(function(cb) { | ||
setTimeout(cb, 3); | ||
setTimeout(cb, 0); | ||
}); | ||
@@ -29,17 +19,25 @@ | ||
setTimeout(function() { | ||
// session has changed so this should be a nop | ||
cb(); | ||
// and we should still have one job left | ||
t.equal(q.length, 1); | ||
}, 3); | ||
}, 5); | ||
}, 30); | ||
}, 30); | ||
}); | ||
q.push(function(cb) { | ||
setTimeout(cb, 7); | ||
setTimeout(cb, 90); | ||
}); | ||
q.start(); | ||
q.start(function(err) { | ||
t.equal(q.length, 0); | ||
if (err) { | ||
q.push(function(cb) { | ||
setTimeout(cb, 0); | ||
}); | ||
} | ||
}); | ||
}); |
@@ -16,3 +16,3 @@ var tape = require('tape'); | ||
q.push(function(cb) { | ||
setTimeout(cb, 3); | ||
setTimeout(cb, 30); | ||
}); | ||
@@ -23,7 +23,7 @@ | ||
cb(new Error('something broke')); | ||
}, 5); | ||
}, 60); | ||
}); | ||
q.push(function(cb) { | ||
setTimeout(cb, 7); | ||
setTimeout(cb, 90); | ||
}); | ||
@@ -30,0 +30,0 @@ |
@@ -9,7 +9,2 @@ var tape = require('tape'); | ||
q.on('end', function() { | ||
t.equal(q.pending, 0); | ||
t.equal(q.length, 0); | ||
}); | ||
q.push(function(cb) { | ||
@@ -20,3 +15,3 @@ setTimeout(function() { | ||
t.equal(q.length, 2); | ||
}, 3); | ||
}, 0); | ||
}); | ||
@@ -29,3 +24,3 @@ | ||
t.equal(q.length, 1); | ||
}, 5); | ||
}, 30); | ||
}); | ||
@@ -38,3 +33,3 @@ | ||
t.equal(q.length, 0); | ||
}, 7); | ||
}, 60); | ||
}); | ||
@@ -45,3 +40,6 @@ | ||
q.start(); | ||
q.start(function() { | ||
t.equal(q.pending, 0); | ||
t.equal(q.length, 0); | ||
}); | ||
@@ -48,0 +46,0 @@ t.equal(q.pending, 3); |
@@ -17,4 +17,4 @@ var tape = require('tape'); | ||
q.start(); | ||
}, 20); | ||
}, 20); | ||
}, 100); | ||
}, 100); | ||
}); | ||
@@ -36,3 +36,3 @@ | ||
q.stop(); | ||
}, 10); | ||
}); | ||
}, 0); | ||
}); |
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
14548
170
385