sanic-org/sanic

Graceful shutdown of signal handlers

オープン

#2,369 opened on 2022/01/12

 (5 件のコメント) (0 件のリアクション) (1 人の担当者)Python (1,515 件のフォーク)batch import
beginnerhelp wanted

Repository metrics

Stars
 (17,623 個のスター)
PR merge metrics
 (30d に merged PR はありません)

説明

When signals are added, we should run some sort of a cleanup like this on shutdown to make sure any custom signals are run. This also includes a suggestion that we identify them with a name: signal-XXXXX.

async def cleanup(app, _):
    for task in asyncio.all_tasks():
        if task.get_name().startswith("signal"):
          await task

コントリビューターガイド