Rename shutdownGracefully to triggerGracefulShutdown on the ServiceGroup (#142)

This commit is contained in:
Franz Busch authored and GitHub committed 2023-06-01 09:03:11 +02:00
1 parent 7a8226c92d
commit 4eaaf079a8
2 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -102,7 +102,7 @@ public actor ServiceGroup: Sendable {
/// Triggers the graceful shutdown of all services.
///
/// This method returns immediately after triggering the graceful shutdown and doesn't wait until the service have shutdown.
public func shutdownGracefully() async {
public func triggerGracefulShutdown() async {
switch self.state {
case .initial:
// We aren't even running so we can stop right away.
@@ -487,7 +487,7 @@ final class ServiceGroupTests: XCTestCase {
}
}
func testShutdownGracefully() async throws {
func testTriggerGracefulShutdown() async throws {
let configuration = ServiceGroupConfiguration(gracefulShutdownSignals: [])
let service1 = MockService(description: "Service1")
let service2 = MockService(description: "Service2")
@@ -508,7 +508,7 @@ final class ServiceGroupTests: XCTestCase {
var eventIterator3 = service3.events.makeAsyncIterator()
await XCTAsyncAssertEqual(await eventIterator3.next(), .run)
await serviceGroup.shutdownGracefully()
await serviceGroup.triggerGracefulShutdown()
// The last service should receive the shutdown signal first
await XCTAsyncAssertEqual(await eventIterator3.next(), .shutdownGracefully)