standardize some function signatures and factor out a lot of boilerplate

This commit is contained in:
ansuz
2020-02-03 18:32:21 -05:00
parent d1c6e67d17
commit 88be40ede3
5 changed files with 95 additions and 129 deletions

View File

@@ -59,13 +59,16 @@ Core.getSession = function (Sessions, key) {
return user;
};
Core.expireSession = function (Sessions, key) {
var session = Sessions[key];
if (!session) { return; }
if (session.blobstage) {
session.blobstage.close();
}
delete Sessions[key];
Core.expireSession = function (Sessions, key, cb) {
setTimeout(function () {
var session = Sessions[key];
if (!session) { return; }
if (session.blobstage) {
session.blobstage.close();
}
delete Sessions[key];
cb(void 0, 'OK');
});
};
var isTooOld = function (time, now) {