Skip to content

Node.js based forum software built for the modern web

fix performance issue with acp

Barış Soner Uşaklı53249de7990f
diff --git a/src/controllers/admin/dashboard.js b/src/controllers/admin/dashboard.js
index 565d23e563..24a65983f1 100644
--- a/src/controllers/admin/dashboard.js
+++ b/src/controllers/admin/dashboard.js
@@ -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);
diff --git a/src/controllers/admin/users.js b/src/controllers/admin/users.js
index c68fbb8d09..3651767153 100644
--- a/src/controllers/admin/users.js
+++ b/src/controllers/admin/users.js
@@ -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) {
diff --git a/src/controllers/users.js b/src/controllers/users.js
index cefa6b6cc7..1eb5989c1c 100644
--- a/src/controllers/users.js
+++ b/src/controllers/users.js
@@ -145,7 +145,7 @@ usersController.getUsersAndCount = function(set, uid, start, stop, callback) {
count: function(next) {
if (set === 'users:online') {
var now = Date.now();
- db.sortedSetCount('users:online', now - 300000, now, next);
+ db.sortedSetCount('users:online', now - 300000, '+inf', next);
} else if (set === 'users:banned') {
db.sortedSetCard('users:banned', next);
} else {
diff --git a/src/user.js b/src/user.js
index 582686f774..19c60fc1fd 100644
--- a/src/user.js
+++ b/src/user.js
@@ -69,7 +69,7 @@ var async = require('async'),
if (set === 'users:online') {
var count = parseInt(stop, 10) === -1 ? stop : stop - start + 1;
var now = Date.now();
- db.getSortedSetRevRangeByScore(set, start, count, now, now - 300000, callback);
+ db.getSortedSetRevRangeByScore(set, start, count, '+inf', now - 300000, callback);
} else {
db.getSortedSetRevRange(set, start, stop, callback);
}