mirror of
https://github.com/bewcloud/bewcloud.git
synced 2026-03-11 08:54:49 +00:00
Fix news cleanup cron (was deleting even in feeds without recent articles)
This commit is contained in:
parent
fbcaab53d0
commit
13b76ba2e0
1 changed files with 2 additions and 2 deletions
|
|
@ -41,10 +41,10 @@ export async function cleanupOldArticles() {
|
|||
for (const feed of feeds) {
|
||||
const recentArticlesCount = (await db.query<{ count: number }>(
|
||||
sql`SELECT COUNT("id") AS "count" FROM "bewcloud_news_feed_articles" WHERE "feed_id" = $1 AND "article_date" >= $2`,
|
||||
[feed.id, oneMonthAgo],
|
||||
[feed.id, oneMonthAgo.toISOString().substring(0, 10)],
|
||||
))[0].count;
|
||||
|
||||
// Don't delete old articles if the feed doesn't have recent articles (to skip feeds with less items in total)
|
||||
// Don't delete old articles if the feed doesn't have many recent articles (low frequency feeds)
|
||||
if (recentArticlesCount <= 5) {
|
||||
feedIdsToSkip.add(feed.id);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue