Skip to content

Commit

Permalink
Enhance error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
aigoncharov committed Jul 12, 2024
1 parent 420688f commit 6363ef6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "telegram-to-rss"
version = "0.2.2"
version = "0.2.3"
description = ""
authors = ["aigoncharov"]
license = "MIT"
Expand Down
28 changes: 17 additions & 11 deletions telegram_to_rss/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,23 @@ async def start_rss_generation():
async def update_rss():
global rss_task

logging.info("update_rss -> db")
await update_feeds_in_db(telegram_poller=telegram_poller)

logging.info("update_rss -> cache")
await update_feeds_cache(feed_render_dir=static_path)

logging.info("update_rss -> sleep")
await asyncio.sleep(update_interval_seconds)

loop = asyncio.get_event_loop()
rss_task = loop.create_task(update_rss())
try:
logging.info("update_rss -> db")
await update_feeds_in_db(telegram_poller=telegram_poller)

logging.info("update_rss -> cache")
await update_feeds_cache(feed_render_dir=static_path)

logging.info("update_rss -> sleep")
await asyncio.sleep(update_interval_seconds)

logging.info("update_rss -> scheduling a new run")
loop = asyncio.get_event_loop()
rss_task = loop.create_task(update_rss())
except Exception as e:
rss_task = None
logging.error(f"update_rss -> error: {e}")
raise e

await client.start()

Expand Down

0 comments on commit 6363ef6

Please sign in to comment.