[Pkg-javascript-commits] [node-async] 412/480: Add idle() function to determine if the queue has any work
Jonas Smedegaard
js at moszumanska.debian.org
Fri May 2 08:58:47 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 e87eacd90327869880d8cc6f26ba300554d68720
Author: Craig Andrews <craig.andrews at bskyb.com>
Date: Tue Sep 10 13:36:15 2013 +0100
Add idle() function to determine if the queue has any work
Documented idle() and running() functions.
---
README.md | 2 ++
lib/async.js | 3 +++
2 files changed, 5 insertions(+)
diff --git a/README.md b/README.md
index a60ca4d..acee1b2 100644
--- a/README.md
+++ b/README.md
@@ -1075,6 +1075,8 @@ The `queue` object returned by this function has the following properties and
methods:
* `length()` - a function returning the number of items waiting to be processed.
+* `running()` - a function returning the number of items currently being processed.
+* `idle()` - a function returning false if there are items waiting or being processed, or true if not.
* `concurrency` - an integer for determining how many `worker` functions should be
run in parallel. This property can be changed after a `queue` is created to
alter the concurrency on-the-fly.
diff --git a/lib/async.js b/lib/async.js
index 312e645..2313bb1 100755
--- a/lib/async.js
+++ b/lib/async.js
@@ -755,6 +755,9 @@
},
running: function () {
return workers;
+ },
+ idle: function() {
+ return q.tasks.length == 0 && workers == 0;
}
};
return q;
--
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