mirror of
https://gitlab.com/chicken-riders/RcGcDb.git
synced 2025-02-23 00:54:09 +00:00
Fixed exception on debug dump for cancelled tasks
This commit is contained in:
parent
44250a4200
commit
fab76d7355
|
@ -53,7 +53,10 @@ class DomainManager:
|
|||
return (payload[0 + i:length + i] for i in range(0, len(payload), length))
|
||||
|
||||
async def webhook_update(self, connection: asyncpg.Connection, pid: int, channel: str, payload: str):
|
||||
def result_handler(result):
|
||||
def result_handler(result: asyncio.Task):
|
||||
if result.cancelled():
|
||||
return "cancelled"
|
||||
result = result.result()
|
||||
if result is None:
|
||||
return None
|
||||
if isinstance(result, Exception):
|
||||
|
@ -116,7 +119,7 @@ class DomainManager:
|
|||
}
|
||||
await self.task_tracker(one_update=True)
|
||||
for task_name, task in self.task_store.items():
|
||||
json_object["tasks"][task_name] = {"done": task.done(), "result": result_handler(task.result()) if task.done() else None}
|
||||
json_object["tasks"][task_name] = {"done": task.done(), "result": result_handler(task) if task.done() else None}
|
||||
for name, domain in self.domains.items():
|
||||
json_object["domains"][name] = domain.json()
|
||||
for message in messagequeue._queue:
|
||||
|
|
Loading…
Reference in a new issue