Skip to content

Commit 03d4fd0

Browse files
authored
Merge pull request #415 from SoftwareEngineeringDaily/feat/private-feed-megaphone
fix: Sending latest 300 elements
2 parents d1068bf + 5d75365 commit 03d4fd0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/crons/rssFeed.cron.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ async function getPrivateFeed() {
2222
throw err;
2323
}
2424
parsedResult = result;
25+
parsedResult.rss.channel.item = parsedResult.rss.channel.item.slice(0, 300);
2526
});
2627
}
2728
} catch (error) {
@@ -102,6 +103,8 @@ function encode(text) {
102103
}
103104

104105
async function callback() {
106+
const privateFeedConfig = await getPrivateFeed();
107+
105108
const posts = await Post.find().where('status').equals('publish').lean();
106109

107110
// mongoose sort is slower
@@ -111,7 +114,6 @@ async function callback() {
111114

112115
const publicFeedAllConfig = cloneDeep(rawFeedConfig);
113116
const publicFeedConfig = cloneDeep(rawFeedConfig);
114-
const privateFeedConfig = await getPrivateFeed();
115117
const lastPost = posts[posts.length - 1];
116118

117119
let episode = posts.length + 1;

0 commit comments

Comments
 (0)