Merge pull request #2108 from goldquest/dev_deleteSessionBug

Session deletion error, when group2session/author2session are not available
This commit is contained in:
John McLear 2014-03-14 17:22:46 +00:00
commit cd0f5742f6
1 changed files with 9 additions and 5 deletions

View File

@ -263,12 +263,16 @@ exports.deleteSession = function(sessionID, callback)
db.remove("session:" + sessionID);
//remove session from group2sessions
delete group2sessions.sessionIDs[sessionID];
db.set("group2sessions:" + groupID, group2sessions);
if(group2sessions != null) { // Maybe the group was already deleted
delete group2sessions.sessionIDs[sessionID];
db.set("group2sessions:" + groupID, group2sessions);
}
//remove session from author2sessions
delete author2sessions.sessionIDs[sessionID];
db.set("author2sessions:" + authorID, author2sessions);
if(author2sessions != null) { // Maybe the author was already deleted
delete author2sessions.sessionIDs[sessionID];
db.set("author2sessions:" + authorID, author2sessions);
}
callback();
}