From fff6f1eacd56c52fed9c81fa4b0fbb2568fb3225 Mon Sep 17 00:00:00 2001 From: retoor Date: Thu, 9 Jan 2025 22:10:16 +0100 Subject: [PATCH] Error handling... --- src/drstats/sync.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/drstats/sync.py b/src/drstats/sync.py index cea36e9..794b419 100644 --- a/src/drstats/sync.py +++ b/src/drstats/sync.py @@ -81,7 +81,14 @@ async def sync_comments(): rants_synced = 0 for rant in db["rants"].find(order_by="-id"): rants_synced += 1 - comments = dr.get_rant(rant["id"]).get("comments", []) + try: + comments = dr.get_rant(rant["id"]).get("comments", []) + except Exception as ex: + print(ex) + print("Sleeping for a second..") + await asyncio.sleep(1) + continue + for comment in comments: comments_synced += 1 comment["created"] = timestamp_to_string(comment["created_time"])