Made get rants async.
This commit is contained in:
parent
c44567e57c
commit
60d83b3022
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user