Skip to content

Rename shutdownGracefully to triggerGracefulShutdown on the ServiceGroup #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/ServiceLifecycle/ServiceGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions Tests/ServiceLifecycleTests/ServiceGroupTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)
Expand Down