swift-server/swift-service-lifecycle

Provide a `CancelOnGracefulShutdownService`

オープン

#163 opened on 2023/10/31

 (3 件のコメント) (0 件のリアクション) (0 人の担当者)Swift (48 件のフォーク)auto 404
good first issue

Repository metrics

Stars
 (528 個のスター)
PR merge metrics
 (PR metrics pending)

説明

If an adopter already has a reference type that implements a run() method it is currently impossible to support ServiceLifecycle, even though the implementation works easily:

extension MyExistingService: Service {}

The reason for this is, that ServiceLifecycle uses gracefulShutdown to signal shutdown instead of Task cancellation. That is the correct call. However it is impossible to add gracefulShutdown support to object that already expose a run() method. That's why im proposing that ServiceLifecycle offers a CancelOnGracefulShutdownService<Underlying: Service>.

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