users:online refactor

This commit is contained in:
barisusakli
2014-11-28 14:25:11 -05:00
parent 1ce3c9ca2d
commit 5ac5d20e4b
6 changed files with 109 additions and 174 deletions

View File

@@ -15,7 +15,8 @@ usersController.getOnlineUsers = function(req, res, next) {
user.getUsersFromSet('users:online', 0, 49, next);
},
count: function(next) {
next(null, websockets.getConnectedClients().length);
var now = Date.now();
db.sortedSetCount('users:online', now - 300000, now, next);
},
isAdministrator: function(next) {
user.isAdministrator(uid, next);