Browse Source

Callback with only error if it exists.

feature/nested-cache-fetch-fix
Elliott Foster 11 years ago
parent
commit
c0d907cbd1
  1. 7
      lib/caching.js

7
lib/caching.js

@ -49,7 +49,7 @@ var caching = function (args) {
var work_args = Array.prototype.slice.call(arguments, 0); var work_args = Array.prototype.slice.call(arguments, 0);
if (work_args[0]) { // assume first arg is an error if (work_args[0]) { // assume first arg is an error
self.queues[key].forEach(function (done) { self.queues[key].forEach(function (done) {
done.apply(null, work_args); done.call(null, work_args[0]);
}); });
delete self.queues[key]; delete self.queues[key];
return; return;
@ -61,14 +61,11 @@ var caching = function (args) {
done.call(null, err); done.call(null, err);
}); });
} }
else if (!err) { else {
self.queues[key].forEach(function (done) { self.queues[key].forEach(function (done) {
done.apply(null, work_args); done.apply(null, work_args);
}); });
} }
else {
return;
}
delete self.queues[key]; delete self.queues[key];
}); });

Loading…
Cancel
Save