Skip to content

Commit

Permalink
improvement: harden news downloading and log errors
Browse files Browse the repository at this point in the history
background: @task.loop fails silently without giving any indication of what's going on. they also try again after failing, when `reconnect=True`.
  • Loading branch information
maduck committed Jul 26, 2020
1 parent d313272 commit 758665e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,9 +644,13 @@ async def show_latest_news(self):
async def test_task(discord_client):
lock = asyncio.Lock()
async with lock:
downloader = NewsDownloader()
downloader.process_news_feed()
await discord_client.show_latest_news()
try:
downloader = NewsDownloader()
downloader.process_news_feed()
await discord_client.show_latest_news()
except Exception as e:
log.error('Could not update news. Stacktrace follows.')
log.exception(e)


if __name__ == '__main__':
Expand Down

0 comments on commit 758665e

Please sign in to comment.