Browse Source

Lint fixes

feature/nested-cache-fetch-fix
Alejandro Torrado 10 years ago
parent
commit
80f2318638
  1. 6
      lib/caching.js
  2. 12
      lib/multi_caching.js

6
lib/caching.js

@ -47,8 +47,8 @@ var caching = function (args) {
self.queues[key] = [cb]; self.queues[key] = [cb];
function fillCallbacks(err, data){ function fillCallbacks(err, data) {
self.queues[key].forEach(function(f){ self.queues[key].forEach(function(f) {
f(err, data); f(err, data);
}); });
delete self.queues[key]; delete self.queues[key];
@ -69,7 +69,7 @@ var caching = function (args) {
if (err && (!self.ignoreCacheErrors)) { if (err && (!self.ignoreCacheErrors)) {
fillCallbacks(err); fillCallbacks(err);
} else { } else {
fillCallbacks(err, data); fillCallbacks(null, data);
} }
}); });
}); });

12
lib/multi_caching.js

@ -54,8 +54,8 @@ var multi_caching = function (caches) {
self.queues[key] = [cb]; self.queues[key] = [cb];
function fillCallbacks(err, data){ function fillCallbacks(err, data) {
self.queues[key].forEach(function(f){ self.queues[key].forEach(function(f) {
f(err, data); f(err, data);
}); });
delete self.queues[key]; delete self.queues[key];
@ -77,7 +77,7 @@ var multi_caching = function (caches) {
} else { } else {
work(function (err, data) { work(function (err, data) {
if (err) { if (err) {
fillCallbacks(err, data); fillCallbacks(err, null);
return; return;
} }
var opts = { var opts = {
@ -86,7 +86,11 @@ var multi_caching = function (caches) {
ttl: ttl ttl: ttl
}; };
set_in_multiple_caches(caches, opts, function (err) { set_in_multiple_caches(caches, opts, function (err) {
fillCallbacks(null, data); if (err) {
fillCallbacks(err);
} else {
fillCallbacks(null, data);
}
}); });
}); });
} }

Loading…
Cancel
Save