From 1082dd7a71775721aa438c7e9f03d7f58ad63545 Mon Sep 17 00:00:00 2001 From: Fabian Stamm Date: Wed, 26 Apr 2023 19:58:59 +0200 Subject: [PATCH] Fix bug --- package.json | 2 +- src/feed_fetcher.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index ef9a9e5..06f9d26 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rss-telegram-bot", - "version": "2.0.1", + "version": "2.0.2", "main": "lib/index.js", "author": "Fabian Stamm ", "license": "MIT", diff --git a/src/feed_fetcher.ts b/src/feed_fetcher.ts index 8bbd369..605ff03 100644 --- a/src/feed_fetcher.ts +++ b/src/feed_fetcher.ts @@ -103,6 +103,7 @@ const FEED_CHECK_INTERVAL = 1000 * 30; export default async function checkFeeds() { while (true) { + Logging.info("Checking for feeds to synchronize"); let feed = await AppDataSource.manager.findOne(Feed, { where: { lastCheck: LessThan(new Date(Date.now() - FEED_CHECK_INTERVAL)) @@ -113,14 +114,14 @@ export default async function checkFeeds() { }) if (!feed) { - await new Promise(y => setTimeout(y, 1000)); + await new Promise(y => setTimeout(y, 10000)); continue; } feed.lastCheck = new Date(); await AppDataSource.manager.save(feed); - Promise.resolve(async () => { + Promise.resolve().then(async () => { await checkFeed(feed); }).catch(err => { Logging.warn("Error while checking feed: %s", feed.url);