diff options
author | Aydar Zartdinov <zartdinov@gmail.com> | 2015-07-09 06:32:14 +0300 |
---|---|---|
committer | Aydar Zartdinov <zartdinov@gmail.com> | 2015-07-09 06:32:14 +0300 |
commit | ec63006d767246aaf92b0bc474bf4043380dbad7 (patch) | |
tree | 810350771f2ae4e80b6a27f3b3f12dec58ae0668 /lib | |
parent | 3c2fd71e350f6a5cda22696ed7cc2022fe566128 (diff) | |
parent | 7ea45d7fc816235003d319e1ce96582a4c65d77a (diff) | |
download | async-ec63006d767246aaf92b0bc474bf4043380dbad7.tar.gz |
Merge branch 'master' of https://github.com/caolan/async
Conflicts:
package.json
Diffstat (limited to 'lib')
-rw-r--r-- | lib/async.js | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/lib/async.js b/lib/async.js index 84d17aa..e756854 100644 --- a/lib/async.js +++ b/lib/async.js @@ -584,19 +584,19 @@ var attempts = []; var opts = { - times: DEFAULT_TIMES, - interval: DEFAULT_INTERVAL + times: DEFAULT_TIMES, + interval: DEFAULT_INTERVAL }; function parseTimes(acc, t){ - if(typeof t === 'number'){ - acc.times = parseInt(t, 10) || DEFAULT_TIMES; - } else if(typeof t === 'object'){ - acc.times = parseInt(t.times, 10) || DEFAULT_TIMES; - acc.interval = parseInt(t.interval, 10) || DEFAULT_INTERVAL; - } else { - throw new Error('Unsupported argument type for \'times\': ' + typeof(t)); - } + if(typeof t === 'number'){ + acc.times = parseInt(t, 10) || DEFAULT_TIMES; + } else if(typeof t === 'object'){ + acc.times = parseInt(t.times, 10) || DEFAULT_TIMES; + acc.interval = parseInt(t.interval, 10) || DEFAULT_INTERVAL; + } else { + throw new Error('Unsupported argument type for \'times\': ' + typeof(t)); + } } var length = arguments.length; @@ -622,11 +622,11 @@ } function retryInterval(interval){ - return function(seriesCallback){ - setTimeout(function(){ - seriesCallback(null); - }, interval); - }; + return function(seriesCallback){ + setTimeout(function(){ + seriesCallback(null); + }, interval); + }; } while (opts.times) { @@ -634,7 +634,7 @@ var finalAttempt = !(opts.times-=1); attempts.push(retryAttempt(opts.task, finalAttempt)); if(!finalAttempt && opts.interval > 0){ - attempts.push(retryInterval(opts.interval)); + attempts.push(retryInterval(opts.interval)); } } @@ -835,7 +835,7 @@ if(data.length === 0 && q.idle()) { // call drain immediately if there are no tasks return async.setImmediate(function() { - q.drain(); + q.drain(); }); } _arrayEach(data, function(task) { @@ -951,17 +951,17 @@ } function _binarySearch(sequence, item, compare) { - var beg = -1, - end = sequence.length - 1; - while (beg < end) { - var mid = beg + ((end - beg + 1) >>> 1); - if (compare(item, sequence[mid]) >= 0) { - beg = mid; - } else { - end = mid - 1; - } - } - return beg; + var beg = -1, + end = sequence.length - 1; + while (beg < end) { + var mid = beg + ((end - beg + 1) >>> 1); + if (compare(item, sequence[mid]) >= 0) { + beg = mid; + } else { + end = mid - 1; + } + } + return beg; } function _insert(q, data, priority, callback) { @@ -1060,7 +1060,7 @@ var q = queues[key]; delete queues[key]; for (var i = 0, l = q.length; i < l; i++) { - q[i].apply(null, args); + q[i].apply(null, args); } })])); } |