Made get rants async.

This commit is contained in:
retoor 2024-11-25 20:39:06 +01:00
parent c44567e57c
commit 60d83b3022

View File

@ -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: