Fix incorrect use of time()

This commit is contained in:
Tulir Asokan 2021-04-10 14:20:55 +03:00
parent 5efba56c3b
commit c185b31b1c
2 changed files with 3 additions and 4 deletions

View file

@ -1,6 +1,6 @@
maubot: 0.1.0 maubot: 0.1.0
id: xyz.maubot.rss id: xyz.maubot.rss
version: 0.2.4 version: 0.2.5
license: AGPL-3.0-or-later license: AGPL-3.0-or-later
modules: modules:
- rss - rss

View file

@ -18,7 +18,6 @@ from datetime import datetime
from time import mktime, time from time import mktime, time
from string import Template from string import Template
import asyncio import asyncio
import time
import aiohttp import aiohttp
import hashlib import hashlib
@ -112,7 +111,7 @@ class RSSBot(Plugin):
subs = self.db.get_feeds() subs = self.db.get_feeds()
if not subs: if not subs:
return return
now = int(time.time()) now = int(time())
tasks = [self.try_parse_feed(feed=feed) for feed in subs if feed.next_retry < now] tasks = [self.try_parse_feed(feed=feed) for feed in subs if feed.next_retry < now]
feed: Feed feed: Feed
entries: Iterable[Entry] entries: Iterable[Entry]
@ -122,7 +121,7 @@ class RSSBot(Plugin):
error_count = feed.error_count + 1 error_count = feed.error_count + 1
next_retry_delay = self.config["update_interval"] * 60 * error_count next_retry_delay = self.config["update_interval"] * 60 * error_count
next_retry_delay = min(next_retry_delay, self.config["max_backoff"] * 60) next_retry_delay = min(next_retry_delay, self.config["max_backoff"] * 60)
next_retry = int(time.time() + next_retry_delay) next_retry = int(time() + next_retry_delay)
self.db.set_backoff(feed, error_count, next_retry) self.db.set_backoff(feed, error_count, next_retry)
continue continue
elif feed.error_count > 0: elif feed.error_count > 0: