up fix to sitenotimplementedexception

This commit is contained in:
2023-09-26 00:01:09 +03:00
committed by nikili0n
parent d8c915d22f
commit da9cf5dbcb
3 changed files with 29 additions and 5 deletions

View File

@ -45,13 +45,29 @@ app.add_middleware(
TypeError: string indices must be integers
'''
'''
queue_name -> [
"{link...}",
"{link2...}",
"{link3..}"
]
queue_name -> {
"link1" -> {vars},
"link2" -> {vars},
"link3" -> {vars},
}
'''
async def is_task_already_done_or_exist(redis: RedisClient, link: str):
messages = await redis.get_task_done_queue()
temp = [json.loads(msg) for msg in messages]
print(temp)
tasks = [
literal_eval(message.decode('utf-8')) for message in messages
if literal_eval(message.decode('utf-8'))["link"] == link
and literal_eval(message.decode('utf-8'))["status"] in ["done", "exist"]
msg for msg in temp
if msg["link"] == link
and msg["status"] in ["done", "exist"]
]
if len(tasks) > 0: