diff --git a/src/drstats/sync.py b/src/drstats/sync.py index 7145bde..75709ac 100644 --- a/src/drstats/sync.py +++ b/src/drstats/sync.py @@ -25,9 +25,15 @@ def timestamp_to_string(timestamp): async def get_recent_rants(start_from=1, page_size=10): + loop = asyncio.get_running_loop() page = 0 while True: - rants = dr.get_rants("recent", page_size, start_from)["rants"] + + def get_rants(): + return dr.get_rants("recent", page_size, start_from)["rants"] + + rants = asyncio.wait_for(asyncio.run_in_executor(get_rants), 5) + page += 1 for rant in rants: if rant is None: