Skip to content

Commit d0c7254

Browse files
committed
Conform ServiceGroup to Service
# Motivation It is possible to nest a `ServiceGroup` inside another `ServiceGroup` however we were missing the conformance to `Service` on the group. # Modification This PR adds the conformance to `Service` to `ServiceGroup`.
1 parent cdd6040 commit d0c7254

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Sources/ServiceLifecycle/ServiceGroup.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import Logging
1616
import UnixSignals
1717

1818
/// A ``ServiceGroup`` is responsible for running a number of services, setting up signal handling and signalling graceful shutdown to the services.
19-
public actor ServiceGroup: Sendable {
19+
public actor ServiceGroup: Sendable, Service {
2020
/// The internal state of the ``ServiceGroup``.
2121
private enum State {
2222
/// The initial state of the group.
@@ -104,6 +104,16 @@ public actor ServiceGroup: Sendable {
104104
self.maximumCancellationDuration = configuration._maximumCancellationDuration
105105
}
106106

107+
/// Runs all the services by spinning up a child task per service.
108+
/// Furthermore, this method sets up the correct signal handlers
109+
/// for graceful shutdown.
110+
// We normally don't use underscored attributes but we really want to use the method with
111+
// file and line whenever possible.
112+
@_disfavoredOverload
113+
public func run() async throws {
114+
try await self.run(file: #file, line: #line)
115+
}
116+
107117
/// Runs all the services by spinning up a child task per service.
108118
/// Furthermore, this method sets up the correct signal handlers
109119
/// for graceful shutdown.

0 commit comments

Comments
 (0)