Browse Source

wrapping callbacks in process.nextTick - seems to fix #21

feature/nested-cache-fetch-fix
Bryan Donovan 10 years ago
parent
commit
c9cd977340
  1. 6
      lib/caching.js
  2. 6
      lib/multi_caching.js

6
lib/caching.js

@ -51,8 +51,10 @@ var caching = function(args) {
function fillCallbacks(err, data) {
self.queues[key].forEach(function(task) {
var taskDomain = task.domain || domain.create();
taskDomain.bind(task.cb)(err, data);
process.nextTick(function() {
var taskDomain = task.domain || domain.create();
taskDomain.bind(task.cb)(err, data);
});
});
delete self.queues[key];
}

6
lib/multi_caching.js

@ -79,8 +79,10 @@ var multi_caching = function(caches) {
function fillCallbacks(err, data) {
self.queues[key].forEach(function(task) {
var taskDomain = task.domain || domain.create();
taskDomain.bind(task.cb)(err, data);
process.nextTick(function() {
var taskDomain = task.domain || domain.create();
taskDomain.bind(task.cb)(err, data);
});
});
delete self.queues[key];
}

Loading…
Cancel
Save