[Pkg-javascript-commits] [node-async] 115/480: expose tasks array for queues
Jonas Smedegaard
js at moszumanska.debian.org
Fri May 2 08:58:17 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 25f2dbf43a07087ec0f09f9b42207dc3f5591fd5
Author: Caolan McMahon <caolan at caolanmcmahon.com>
Date: Tue Nov 1 16:04:22 2011 -0700
expose tasks array for queues
---
dist/async.min.js | 2 +-
lib/async.js | 16 ++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/dist/async.min.js b/dist/async.min.js
index 3b34d30..e4c898b 100644
--- a/dist/async.min.js
+++ b/dist/async.min.js
@@ -1 +1 @@
-/*global setTimeout: false, console: false */(function(){var a={},b=this,c=b.async;typeof module!="undefined"&&module.exports?module.exports=a:b.async=a,a.noConflict=function(){return b.async=c,a};var d=function(a,b){if(a.forEach)return a.forEach(b);for(var c=0;c<a.length;c+=1)b(a[c],c,a)},e=function(a,b){if(a.map)return a.map(b);var c=[];return d(a,function(a,d,e){c.push(b(a,d,e))}),c},f=function(a,b,c){return a.reduce?a.reduce(b,c):(d(a,function(a,d,e){c=b(c,a,d,e)}),c)},g=function(a){ [...]
\ No newline at end of file
+/*global setTimeout: false, console: false */(function(){var a={},b=this,c=b.async;typeof module!="undefined"&&module.exports?module.exports=a:b.async=a,a.noConflict=function(){return b.async=c,a};var d=function(a,b){if(a.forEach)return a.forEach(b);for(var c=0;c<a.length;c+=1)b(a[c],c,a)},e=function(a,b){if(a.map)return a.map(b);var c=[];return d(a,function(a,d,e){c.push(b(a,d,e))}),c},f=function(a,b,c){return a.reduce?a.reduce(b,c):(d(a,function(a,d,e){c=b(c,a,d,e)}),c)},g=function(a){ [...]
\ No newline at end of file
diff --git a/lib/async.js b/lib/async.js
index 805b41f..c862008 100644
--- a/lib/async.js
+++ b/lib/async.js
@@ -587,34 +587,34 @@
async.queue = function (worker, concurrency) {
var workers = 0;
- var tasks = [];
var q = {
+ tasks: [],
concurrency: concurrency,
saturated: null,
empty: null,
drain: null,
push: function (data, callback) {
- tasks.push({data: data, callback: callback});
- if(q.saturated && tasks.length == concurrency) q.saturated();
+ q.tasks.push({data: data, callback: callback});
+ if(q.saturated && q.tasks.length == concurrency) q.saturated();
async.nextTick(q.process);
},
process: function () {
- if (workers < q.concurrency && tasks.length) {
- var task = tasks.shift();
- if(q.empty && tasks.length == 0) q.empty();
+ if (workers < q.concurrency && q.tasks.length) {
+ var task = q.tasks.shift();
+ if(q.empty && q.tasks.length == 0) q.empty();
workers += 1;
worker(task.data, function () {
workers -= 1;
if (task.callback) {
task.callback.apply(task, arguments);
}
- if(q.drain && tasks.length + workers == 0) q.drain();
+ if(q.drain && q.tasks.length + workers == 0) q.drain();
q.process();
});
}
},
length: function () {
- return tasks.length;
+ return q.tasks.length;
},
running: function () {
return workers;
--
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