feat(work): add signed task progress and durable status cards

This commit is contained in:
ex_tianzy
2026-11-12 15:18:21 +08:00
parent 2e0d5987c0
commit abe2550dd0
11 changed files with 439 additions and 2 deletions
+6 -1
View File
@@ -298,10 +298,15 @@ def create_app(settings=None, redis=None, platform=None):
# No credentials or raw exception text in background logs.
pass
lifecycle_task = asyncio.create_task(maintenance()) if lifecycle else None
async def card_maintenance():
while True:
await asyncio.sleep(5)
with contextlib.suppress(Exception):await deliveries.cards.flush()
cards_task=asyncio.create_task(card_maintenance()) if lifecycle and deliveries.cards else None
try:
yield
finally:
work = [reply_task,sweep_task,*background] + ([lifecycle_task] if lifecycle_task else [])
work = [reply_task,sweep_task,*background] + ([lifecycle_task] if lifecycle_task else []) + ([cards_task] if cards_task else [])
for task in work:
task.cancel()
await asyncio.gather(*work, return_exceptions=True)