This commit is contained in:
parent
96d457ab11
commit
1082dd7a71
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rss-telegram-bot",
|
"name": "rss-telegram-bot",
|
||||||
"version": "2.0.1",
|
"version": "2.0.2",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"author": "Fabian Stamm <dev@fabianstamm.de>",
|
"author": "Fabian Stamm <dev@fabianstamm.de>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -103,6 +103,7 @@ const FEED_CHECK_INTERVAL = 1000 * 30;
|
|||||||
|
|
||||||
export default async function checkFeeds() {
|
export default async function checkFeeds() {
|
||||||
while (true) {
|
while (true) {
|
||||||
|
Logging.info("Checking for feeds to synchronize");
|
||||||
let feed = await AppDataSource.manager.findOne(Feed, {
|
let feed = await AppDataSource.manager.findOne(Feed, {
|
||||||
where: {
|
where: {
|
||||||
lastCheck: LessThan(new Date(Date.now() - FEED_CHECK_INTERVAL))
|
lastCheck: LessThan(new Date(Date.now() - FEED_CHECK_INTERVAL))
|
||||||
@ -113,14 +114,14 @@ export default async function checkFeeds() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (!feed) {
|
if (!feed) {
|
||||||
await new Promise(y => setTimeout(y, 1000));
|
await new Promise(y => setTimeout(y, 10000));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
feed.lastCheck = new Date();
|
feed.lastCheck = new Date();
|
||||||
await AppDataSource.manager.save(feed);
|
await AppDataSource.manager.save(feed);
|
||||||
|
|
||||||
Promise.resolve(async () => {
|
Promise.resolve().then(async () => {
|
||||||
await checkFeed(feed);
|
await checkFeed(feed);
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
Logging.warn("Error while checking feed: %s", feed.url);
|
Logging.warn("Error while checking feed: %s", feed.url);
|
||||||
|
Loading…
Reference in New Issue
Block a user