async-rails 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7da4f4ef6f4fe64367fbbb814186b4bdcd5112de
4
- data.tar.gz: 20ac90a64ea22281e9a9e0b1e765569eea093a7e
3
+ metadata.gz: ee25678b86dee1c30ef7c20508e540a67521fa93
4
+ data.tar.gz: bf0979d5a97b7d801b8acde08c1e270cf03f3aad
5
5
  SHA512:
6
- metadata.gz: d8acaaa055a6af2f98dc86192e36a29f62018613483bd74d8f96849890665db712d40a759598a401dc3633b8c33fb1bca586a7042f33aee3679501f9885e2b34
7
- data.tar.gz: 9057ef4ce7d05fad47c46826724d360eb22e67c13beef3edb0dcbbdac22f2b009c9b18a7488cfb76161425de6b04682b8797aed3d502efa5e903faccdafcce40
6
+ metadata.gz: 619a704271bfda8e8a5d57fc9814222f7ebb1b5457c0bf553cfd60c58a025ed4274741b46c3562e29b2e1ff29d6459529e9d71b063ddcdb72fe7d1543967fa4a
7
+ data.tar.gz: f01203e1c6fad4832de47cbe0f36c3ce143eb7951fb66b72564d0885def9982c7d1364f6099491957d55c426f6623548bedb6d032325130982a6dc70319e856a
@@ -1,5 +1,5 @@
1
1
  module Async
2
2
  module Rails
3
- VERSION = "0.4.0"
3
+ VERSION = "0.4.1"
4
4
  end
5
5
  end
@@ -402,7 +402,8 @@
402
402
  async.auto = function (tasks, callback) {
403
403
  callback = callback || function () {};
404
404
  var keys = _keys(tasks);
405
- if (!keys.length) {
405
+ var remainingTasks = keys.length
406
+ if (!remainingTasks) {
406
407
  return callback(null);
407
408
  }
408
409
 
@@ -421,13 +422,14 @@
421
422
  }
422
423
  };
423
424
  var taskComplete = function () {
425
+ remainingTasks--
424
426
  _each(listeners.slice(0), function (fn) {
425
427
  fn();
426
428
  });
427
429
  };
428
430
 
429
431
  addListener(function () {
430
- if (_keys(results).length === keys.length) {
432
+ if (!remainingTasks) {
431
433
  var theCallback = callback;
432
434
  // prevent final callback from calling itself if it errors
433
435
  callback = function () {};
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Chen