[Pkg-javascript-commits] [node-async] 446/480: Added kill method to queue
Jonas Smedegaard
js at moszumanska.debian.org
Fri May 2 08:58:50 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository node-async.
commit 0ef0a3c5e82571baed547f58fc561aca19ebe3a0
Author: Hendrich Attila <hendricha at agmen.hu>
Date: Tue Feb 18 09:29:04 2014 +0100
Added kill method to queue
---
lib/async.js | 4 ++++
test/test-async.js | 21 +++++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/lib/async.js b/lib/async.js
index 201e448..a5ffffa 100755
--- a/lib/async.js
+++ b/lib/async.js
@@ -762,6 +762,10 @@
push: function (data, callback) {
_insert(q, data, false, callback);
},
+ kill: function () {
+ q.drain = null;
+ q.tasks = [];
+ },
unshift: function (data, callback) {
_insert(q, data, true, callback);
},
diff --git a/test/test-async.js b/test/test-async.js
index e7a8820..6d65c15 100755
--- a/test/test-async.js
+++ b/test/test-async.js
@@ -2407,6 +2407,27 @@ exports['queue pause'] = function(test) {
}, 800);
}
+exports['queue kill'] = function (test) {
+ var q = async.queue(function (task, callback) {
+ setTimeout(function () {
+ test.ok(false, "Function should never be called");
+ callback();
+ }, 300);
+ }, 1);
+ q.drain = function() {
+ test.ok(false, "Function should never be called");
+ }
+
+ q.push(0);
+
+ q.kill();
+
+ setTimeout(function() {
+ test.equal(q.length(), 0);
+ test.done();
+ }, 600)
+};
+
exports['cargo'] = function (test) {
var call_order = [],
delays = [160, 160, 80];
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-async.git
More information about the Pkg-javascript-commits
mailing list