swift-server/swift-service-lifecycle
Provide a `CancelOnGracefulShutdownService`
开放
#163 创建于 2023年10月31日
good first issue
仓库指标
- 星标
- (528 个星标)
- PR 合并指标
- (平均合并 5天 15小时) (30 天内合并 2 个 PR)
描述
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>.