db/SessionStore.js: call nextTick() only if there is something to do
Changed two occurrences of: process.nextTick(function() { if (fn) fn(); }); with if (fn) { process.nextTick(fn); } i.e. such that no function even gets added to the `nextTick` queue unless there's actually a function to be called. Extracted from Ray's work.pull/3559/head
parent
96d875b4d1
commit
630af9af7d
|
@ -36,18 +36,18 @@ SessionStore.prototype.set = function(sid, sess, fn) {
|
|||
messageLogger.debug('SET ' + sid);
|
||||
|
||||
db.set("sessionstorage:" + sid, sess);
|
||||
process.nextTick(function() {
|
||||
if (fn) fn();
|
||||
});
|
||||
if (fn) {
|
||||
process.nextTick(fn);
|
||||
}
|
||||
};
|
||||
|
||||
SessionStore.prototype.destroy = function(sid, fn) {
|
||||
messageLogger.debug('DESTROY ' + sid);
|
||||
|
||||
db.remove("sessionstorage:" + sid);
|
||||
process.nextTick(function() {
|
||||
if (fn) fn();
|
||||
});
|
||||
if (fn) {
|
||||
process.nextTick(fn);
|
||||
}
|
||||
};
|
||||
|
||||
SessionStore.prototype.all = function(fn) {
|
||||
|
|
Loading…
Reference in New Issue