Skip to content

Node.js based forum software built for the modern web

refactors to sitemap, closed #2254

Julian Lamdfbac595b676
diff --git a/src/sitemap.js b/src/sitemap.js
index dcb3c48f75..6d65719696 100644
--- a/src/sitemap.js
+++ b/src/sitemap.js
@@ -54,34 +54,34 @@ var path = require('path'),
topicUrls: function(next) {
var topicUrls = [];
- db.getSortedSetRevRange('topics:recent', 0, 49, function(err, tids) {
+ async.waterfall([
+ async.apply(db.getSortedSetRevRange, 'topics:recent', 0, -1),
+ function(tids, next) {
+ db.getSortedSetRevRange('topics:recent', 0, -1, next);
+ },
+ function(tids, next) {
+ privileges.topics.filter('read', tids, 0, next);
+ },
+ function(tids, next) {
+ topics.getTopicsFields(tids, ['tid', 'title', 'lastposttime'], next);
+ }
+ ], function(err, topics) {
if (err) {
return next(err);
}
- privileges.topics.filter('read', tids, 0, function(err, tids) {
- if (err) {
- return next(err);
- }
-
- topics.getTopicsFields(tids, ['tid', 'title', 'lastposttime'], function(err, topics) {
- if (err) {
- return next(err);
- }
- topics.forEach(function(topic) {
- if (topic) {
- topicUrls.push({
- url: '/topic/' + topic.tid + '/' + encodeURIComponent(utils.slugify(topic.title)),
- lastmodISO: utils.toISOString(topic.lastposttime),
- changefreq: 'daily',
- priority: '0.6'
- });
- }
+ topics.forEach(function(topic) {
+ if (topic) {
+ topicUrls.push({
+ url: '/topic/' + topic.tid + '/' + encodeURIComponent(utils.slugify(topic.title)),
+ lastmodISO: utils.toISOString(topic.lastposttime),
+ changefreq: 'daily',
+ priority: '0.6'
});
-
- next(null, topicUrls);
- });
+ }
});
+
+ next(null, topicUrls);
});
}
}, function(err, data) {