Skip to content

Commit

Permalink
call the callback in nextTick
Browse files Browse the repository at this point in the history
  • Loading branch information
qzaidi committed Sep 20, 2013
1 parent a9a5848 commit bea1584
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ var cache = {
// and hence this function.
(function(err, data) {
if (!err && data) {
return callback.call(self,err,data); // found in cache
process.nextTick(function() {
callback.call(self,err,data); // found in cache
});
return;
}

args.push(function(err,res) {
Expand All @@ -71,7 +74,6 @@ var cache = {

fn.apply(self,args);
}(null,data));

};
};

Expand Down

0 comments on commit bea1584

Please sign in to comment.