mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +01:00
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.
This commit is contained in:
parent
96d875b4d1
commit
630af9af7d
1 changed files with 6 additions and 6 deletions
|
@ -36,18 +36,18 @@ SessionStore.prototype.set = function(sid, sess, fn) {
|
||||||
messageLogger.debug('SET ' + sid);
|
messageLogger.debug('SET ' + sid);
|
||||||
|
|
||||||
db.set("sessionstorage:" + sid, sess);
|
db.set("sessionstorage:" + sid, sess);
|
||||||
process.nextTick(function() {
|
if (fn) {
|
||||||
if (fn) fn();
|
process.nextTick(fn);
|
||||||
});
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
SessionStore.prototype.destroy = function(sid, fn) {
|
SessionStore.prototype.destroy = function(sid, fn) {
|
||||||
messageLogger.debug('DESTROY ' + sid);
|
messageLogger.debug('DESTROY ' + sid);
|
||||||
|
|
||||||
db.remove("sessionstorage:" + sid);
|
db.remove("sessionstorage:" + sid);
|
||||||
process.nextTick(function() {
|
if (fn) {
|
||||||
if (fn) fn();
|
process.nextTick(fn);
|
||||||
});
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
SessionStore.prototype.all = function(fn) {
|
SessionStore.prototype.all = function(fn) {
|
||||||
|
|
Loading…
Reference in a new issue