swift-service-lifecycle
swift-service-lifecycle copied to clipboard
Cleanly startup and shutdown server application, freeing resources in order before exiting.
Would be great to get an alternative to `startAndWait` for the `async` world that does not block the current thread but just suspends the current task.
Manual state tracking has the advantage that you're able to associate data with a state. For example ```swift enum LifecycleState { case stopped case started(Channel) case stopping(Channel) } ``` migrating...
**Motivation:** Oftentimes when using ServiceLifecycle it's also beneficial to use 'ArgumentParser' to build a CLI for a server-side app, running as part of ServiceLifecycle. **Modifications:** A new 'LifecycleCommand' library target...
The ongoing pitch https://forums.swift.org/t/main-type-based-program-execution/34624 introduces `@main` define-able entry points. It is also aimed for libraries to provide their patterns / entry points. It currently will NOT work with Swift Package...
motivation: having multiple instance of `ServiceLifecycle` generally points to a mistake, which we can help validate changes: add check in **init** to validate single instance alternatively, we may be less...
When developing Swift services locally (macOS), I usually use Docker to run one or more databases. When quickly wanting to test on Linux, I use `docker-compose` to start both the...
The current way of defining lifecycle tasks is simple and works well for single or two frameworks or libraries adding tasks. It gets complex if many libraries need to depend...
Often, sub-systems won't be thread-safe so we rely on start & stop being called from the same thread. That is achievable with `Configuration` however only per `Lifecycle` and not once...
Hello. As of release `v2.4.0`, please consider the following function from the public API. ``` public func cancelOnGracefulShutdown(_ operation: @Sendable @escaping () async throws -> T) async rethrows -> T?...
The following code snippet emits an 'Ambigous use of init' error when using Swift Service Lifecycle v2.3.0: ```swift let config = ServiceGroupConfiguration( services: [], logger: logger ) ``` This problem...