diff --git a/src/categories.js b/src/categories.js index a88c79a1d2..5f04069fe1 100644 --- a/src/categories.js +++ b/src/categories.js @@ -282,13 +282,17 @@ var RDB = require('./redis.js'), } Categories.getRecentReplies = function(cid, count, callback) { - RDB.zrevrange('categories:recent_posts:cid:' + cid, 0, count-1, function(err, pids) { + RDB.zrevrange('categories:recent_posts:cid:' + cid, 0, (count<10)?10:count, function(err, pids) { if (pids.length == 0) { callback([]); return; } + posts.getPostSummaryByPids(pids, function(posts) { + if(posts.length > count) { + posts = posts.slice(0, count); + } callback(posts); }); }); diff --git a/src/posts.js b/src/posts.js index 1a9e7940ca..38dfac0581 100644 --- a/src/posts.js +++ b/src/posts.js @@ -57,24 +57,24 @@ marked.setOptions({ var returnData = []; - var loaded = 0; - - for(var i=0, ii=pids.length; i