From c56b9aafff70f34d276a8525dd35458b95055310 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Fri, 7 Nov 2014 19:40:41 -0500 Subject: [PATCH] closes #2289, replace Infinity with '+inf' --- src/categories/recentreplies.js | 2 +- src/database/mongo/sorted.js | 4 ++-- src/messaging.js | 2 +- src/posts/recent.js | 2 +- src/topics/recent.js | 2 +- src/topics/unread.js | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/categories/recentreplies.js b/src/categories/recentreplies.js index ea500f96f9..38d2c74590 100644 --- a/src/categories/recentreplies.js +++ b/src/categories/recentreplies.js @@ -75,7 +75,7 @@ module.exports = function(Categories) { async.parallel({ pinnedTids: function(next) { - db.getSortedSetRevRangeByScore('cid:' + category.cid + ':tids', 0, -1, Infinity, Date.now(), next); + db.getSortedSetRevRangeByScore('cid:' + category.cid + ':tids', 0, -1, '+inf', Date.now(), next); }, tids: function(next) { db.getSortedSetRevRangeByScore('cid:' + category.cid + ':tids', 0, Math.max(0, count), Date.now(), 0, next); diff --git a/src/database/mongo/sorted.js b/src/database/mongo/sorted.js index 929e5ae814..c3290faad2 100644 --- a/src/database/mongo/sorted.js +++ b/src/database/mongo/sorted.js @@ -167,10 +167,10 @@ module.exports = function(db, module) { } var scoreQuery = {}; - if (min !== -Infinity) { + if (min !== '-inf') { scoreQuery.$gte = min; } - if (max !== Infinity) { + if (max !== '+inf') { scoreQuery.$lte = max; } diff --git a/src/messaging.js b/src/messaging.js index 87832d4325..57aa4ac339 100644 --- a/src/messaging.js +++ b/src/messaging.js @@ -94,7 +94,7 @@ var db = require('./database'), min = 0; } - db.getSortedSetRevRangeByScore('messages:uid:' + uids[0] + ':to:' + uids[1], 0, count, Infinity, min, function(err, mids) { + db.getSortedSetRevRangeByScore('messages:uid:' + uids[0] + ':to:' + uids[1], 0, count, '+inf', min, function(err, mids) { if (err) { return callback(err); } diff --git a/src/posts/recent.js b/src/posts/recent.js index 7f3b43314e..12dab097d4 100644 --- a/src/posts/recent.js +++ b/src/posts/recent.js @@ -19,7 +19,7 @@ module.exports = function(Posts) { var count = parseInt(stop, 10) === -1 ? stop : stop - start + 1; - db.getSortedSetRevRangeByScore('posts:pid', start, count, Infinity, Date.now() - since, function(err, pids) { + db.getSortedSetRevRangeByScore('posts:pid', start, count, '+inf', Date.now() - since, function(err, pids) { if (err) { return callback(err); } diff --git a/src/topics/recent.js b/src/topics/recent.js index a5692d4223..fe51ca319c 100644 --- a/src/topics/recent.js +++ b/src/topics/recent.js @@ -55,7 +55,7 @@ module.exports = function(Topics) { var count = parseInt(end, 10) === -1 ? end : end - start + 1; - db.getSortedSetRevRangeByScore('topics:recent', start, count, Infinity, Date.now() - since, callback); + db.getSortedSetRevRangeByScore('topics:recent', start, count, '+inf', Date.now() - since, callback); }; Topics.updateTimestamp = function(tid, timestamp, callback) { diff --git a/src/topics/unread.js b/src/topics/unread.js index 271eed8ed7..621ca5d65b 100644 --- a/src/topics/unread.js +++ b/src/topics/unread.js @@ -66,10 +66,10 @@ module.exports = function(Topics) { user.getIgnoredCategories(uid, next); }, recentTids: function(next) { - db.getSortedSetRevRangeByScoreWithScores('topics:recent', 0, -1, Infinity, yesterday, next); + db.getSortedSetRevRangeByScoreWithScores('topics:recent', 0, -1, '+inf', yesterday, next); }, userScores: function(next) { - db.getSortedSetRevRangeByScoreWithScores('uid:' + uid + ':tids_read', 0, -1, Infinity, yesterday, next); + db.getSortedSetRevRangeByScoreWithScores('uid:' + uid + ':tids_read', 0, -1, '+inf', yesterday, next); } }, function(err, results) { if (err) {