fix performance issue with acp

This commit is contained in:
Barış Soner Uşaklı
2016-03-09 22:15:03 +02:00
parent bd6d44aeaa
commit 53249de799
4 changed files with 6 additions and 6 deletions

View File

@@ -81,13 +81,13 @@ function getStatsForSet(set, field, callback) {
var now = Date.now();
async.parallel({
day: function(next) {
db.sortedSetCount(set, now - terms.day, now, next);
db.sortedSetCount(set, now - terms.day, '+inf', next);
},
week: function(next) {
db.sortedSetCount(set, now - terms.week, now, next);
db.sortedSetCount(set, now - terms.week, '+inf', next);
},
month: function(next) {
db.sortedSetCount(set, now - terms.month, now, next);
db.sortedSetCount(set, now - terms.month, '+inf', next);
},
alltime: function(next) {
getGlobalField(field, next);

View File

@@ -31,7 +31,7 @@ usersController.noPosts = function(req, res, next) {
usersController.inactive = function(req, res, next) {
var timeRange = 1000 * 60 * 60 * 24 * 30 * (parseInt(req.query.months, 10) || 3);
var cutoff = Date.now() - timeRange;
getUsersByScore('users:online', 'inactive', 0, cutoff, req, res, next);
getUsersByScore('users:online', 'inactive', '-inf', cutoff, req, res, next);
};
function getUsersByScore(set, section, min, max, req, res, callback) {