Skip to content
This repository was archived by the owner on Oct 12, 2021. It is now read-only.

Commit 34c1126

Browse files
committed
disable postCount on rss/podcast collection
1 parent 00c776c commit 34c1126

File tree

6 files changed

+6
-4
lines changed

6 files changed

+6
-4
lines changed

api/src/models/podcast.js

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export const PodcastSchema = new Schema(
106106
type: Number,
107107
default: 0,
108108
},
109+
// @deprecated: considering the huge collection size the count op is really slow
109110
postCount: {
110111
type: Number,
111112
default: 0,

api/src/models/rss.js

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export const RSSSchema = new Schema(
100100
type: Number,
101101
default: 0,
102102
},
103+
// @deprecated: considering the huge collection size the count op is really slow
103104
postCount: {
104105
type: Number,
105106
default: 0,

api/src/workers/podcast.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ export async function handlePodcast(job) {
217217
await Podcast.update(
218218
{ _id: podcastID },
219219
{
220-
postCount: await Episode.count({ podcast: podcastID }),
220+
// postCount: await Episode.count({ podcast: podcastID }),
221221
fingerprint: podcastContent.fingerprint,
222222
guidStability: guidStability || podcast.guidStability,
223223
},

api/src/workers/rss.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ export async function handleRSS(job) {
217217
await RSS.update(
218218
{ _id: rssID },
219219
{
220-
postCount: await Article.count({ rss: rssID }),
220+
// postCount: await Article.count({ rss: rssID }),
221221
fingerprint: rssContent.fingerprint,
222222
guidStability: guidStability || rss.guidStability,
223223
},

api/test/workers/podcast.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ describe('Podcast worker', () => {
123123

124124
it('should update feed data', async () => {
125125
const podcast = await Podcast.findById(data.podcast);
126-
expect(podcast.postCount).to.be.equal(initialEpisodes.length + 649);
126+
// expect(podcast.postCount).to.be.equal(initialEpisodes.length + 649);
127127
});
128128

129129
it('should add episode data to Stream feed', async () => {

api/test/workers/rss.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ describe('RSS worker', () => {
237237

238238
it('should update feed data', async () => {
239239
const rss = await RSS.findById(data.rss);
240-
expect(rss.postCount).to.be.equal(initialArticles.length + newArticleCount);
240+
// expect(rss.postCount).to.be.equal(initialArticles.length + newArticleCount);
241241
expect(rss.guidStability).to.be.equal('STABLE');
242242
});
243243

0 commit comments

Comments
 (0)