mirror of
https://github.com/swift-server/swift-service-lifecycle
synced 2026-11-28 05:14:32 +00:00
Rename shutdownGracefully to triggerGracefulShutdown on the ServiceGroup (#142)
This commit is contained in:
1 parent
7a8226c92d
commit
4eaaf079a8
2 files changed
+3
-3
No files matched your search
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user