swift-server / swift-service-lifecycle

Cleanly startup and shutdown server application, freeing resources in order before exiting.
https://swiftpackageindex.com/swift-server/swift-service-lifecycle/documentation/servicelifecycle
Apache License 2.0
385 stars 37 forks source link

Question: return type of `cancelOnGracefulShutdown` #179

Closed sidepelican closed 4 months ago

sidepelican commented 5 months ago

https://github.com/swift-server/swift-service-lifecycle/blob/f5780d95bdf3f740f14decb6c8c823815c883451/Sources/ServiceLifecycle/GracefulShutdown.swift#L118 I noticed that the cancelOnGracefulShutdown method signature suggests it returns an optional (T?). However, I couldn’t find any code paths in the implementation where a nil value would be returned.

Could you please clarify why the return type is optional in this context? Is there a scenario where this method might return nil that I might have missed?

FranzBusch commented 4 months ago

You are right this seems like a mistake we should fix. This method indeed shouldn't return an optional. Would you be open to work on a PR for this?