Fix news cron locks and fetching to work more than once per day.

This commit is contained in:
Bruno Bernardino
2024-04-19 12:19:26 +01:00
parent a8076f6420
commit 2920de90b6
4 changed files with 18 additions and 8 deletions

View File

@@ -10,9 +10,9 @@ export async function fetchNewArticles(forceFetch = false) {
try {
const feedsToCrawl = await db.query<NewsFeed>(
sql`SELECT * FROM "bewcloud_news_feeds" WHERE "last_crawled_at" IS NULL OR "last_crawled_at" <= $1`,
sql`SELECT * FROM "bewcloud_news_feeds" WHERE "last_crawled_at" IS NULL OR "last_crawled_at" <= $1 ORDER BY "last_crawled_at" ASC`,
[
fourHoursAgo.toISOString().substring(0, 10),
fourHoursAgo.toISOString(),
],
);