This commit is contained in:
parent
38d39dd618
commit
8965395377
|
@ -37,12 +37,6 @@ class ViewedStorage:
|
|||
auth_result = None
|
||||
disabled = False
|
||||
start_date = datetime.now().strftime("%Y-%m-%d")
|
||||
running = True
|
||||
|
||||
@staticmethod
|
||||
async def stop():
|
||||
self = ViewedStorage
|
||||
self.running = False
|
||||
|
||||
@staticmethod
|
||||
async def init():
|
||||
|
@ -202,21 +196,17 @@ class ViewedStorage:
|
|||
if self.disabled:
|
||||
return
|
||||
|
||||
try:
|
||||
while self.running:
|
||||
while True:
|
||||
try:
|
||||
await self.update_pages()
|
||||
failed = 0
|
||||
except Exception as exc:
|
||||
failed += 1
|
||||
logger.debug(exc)
|
||||
logger.warning(" - update failed #%d, wait 10 secs" % failed)
|
||||
if failed > 3 or isinstance(exc, asyncio.CancelledError):
|
||||
logger.error("ViewedStorage worker cancelled")
|
||||
logger.info(" - update failed #%d, wait 10 secs" % failed)
|
||||
if failed > 3:
|
||||
logger.info(" - views update failed, not trying anymore")
|
||||
break
|
||||
finally:
|
||||
self.running = False
|
||||
|
||||
if failed == 0:
|
||||
when = datetime.now(timezone.utc) + timedelta(seconds=self.period)
|
||||
t = format(when.astimezone().isoformat())
|
||||
|
|
Loading…
Reference in New Issue
Block a user