bugfix
This commit is contained in:
parent
557eaeb90e
commit
43bc588294
@ -155,7 +155,7 @@ class LongTasks:
|
|||||||
|
|
||||||
# 2) 执行任务(catch exceptions)
|
# 2) 执行任务(catch exceptions)
|
||||||
try:
|
try:
|
||||||
result = await self.process_task(worker_id, payload)
|
result = await self.process_task(payload, worker_id)
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
# 若希望支持取消,可把 status 设为 cancelling 等
|
# 若希望支持取消,可把 status 设为 cancelling 等
|
||||||
await self.update_task_hash(task_id, {"status": "FAILED", "error": "cancelled"})
|
await self.update_task_hash(task_id, {"status": "FAILED", "error": "cancelled"})
|
||||||
@ -196,7 +196,7 @@ class LongTasks:
|
|||||||
"task_id": taskid,
|
"task_id": taskid,
|
||||||
"status": "PENDING",
|
"status": "PENDING",
|
||||||
"created_at": time.time(),
|
"created_at": time.time(),
|
||||||
"payload": json.dumps(payload)
|
"payload": payload
|
||||||
}
|
}
|
||||||
await self.set_redis_task(taskid, task_data)
|
await self.set_redis_task(taskid, task_data)
|
||||||
await self.redis.rpush(self.task_queue, taskid)
|
await self.redis.rpush(self.task_queue, taskid)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user