Browse Source

Execute queued callbacks on error.

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

12
lib/caching.js

@ -48,7 +48,17 @@ var caching = function (args) {
work(function () { work(function () {
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
return cb(work_args[0]); if (!self.ignoreCacheErrors) {
self.queues[key].forEach(function (done) {
done.apply(null, work_args);
});
delete self.queues[key];
}
else {
cb(work_args[0]);
}
return;
} }
// Subsequently assume second arg is result. // Subsequently assume second arg is result.
self.store.set(key, work_args[1], function (err) { self.store.set(key, work_args[1], function (err) {

Loading…
Cancel
Save