minor fixes, added web serer
This commit is contained in:
@@ -18,8 +18,8 @@ class RedisClient:
|
||||
|
||||
async def _set_task_done(self, task: dict) -> int:
|
||||
async with self.connection as connection:
|
||||
res = await connection.set(
|
||||
f'{self.TASKS_DONE_NAME}:1:{task["link"]}',
|
||||
res = await connection.sadd(
|
||||
f'{self.TASKS_DONE_NAME}:1',
|
||||
json.dumps(task, indent=4).encode('utf-8')
|
||||
)
|
||||
return res
|
||||
@@ -53,3 +53,19 @@ class RedisClient:
|
||||
await self._del_task(task)
|
||||
return await self._set_task_done(task)
|
||||
|
||||
async def get_task_done_queue(self) -> set:
|
||||
async with self.connection as connection:
|
||||
res = await connection.smembers(self.TASKS_DONE_NAME + f":1")
|
||||
return res
|
||||
|
||||
async def del_task_from_task_done_queue(self, task) -> int:
|
||||
async with self.connection as connection:
|
||||
res = await connection.srem(self.TASKS_DONE_NAME + f":1", json.dumps(task, indent=4).encode('utf-8'))
|
||||
return res
|
||||
|
||||
async def get_tasks_queue(self) -> set:
|
||||
async with self.connection as connection:
|
||||
res = await connection.json().get(self.TASKS_NAME)
|
||||
return res
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user