From f53485c1e31993aaf10d12da711dd807c8eebbae Mon Sep 17 00:00:00 2001 From: Fabian Fett Date: Tue, 22 Jul 2025 12:43:42 +0200 Subject: [PATCH] Add public `triggerForceShutdown` to `ConnectionPool` Add distinct method that we need in Valkey (valkey-io/valkey-swift/pulls/#85) --- Sources/ConnectionPoolModule/ConnectionPool.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Sources/ConnectionPoolModule/ConnectionPool.swift b/Sources/ConnectionPoolModule/ConnectionPool.swift index b460b263..ad209fe4 100644 --- a/Sources/ConnectionPoolModule/ConnectionPool.swift +++ b/Sources/ConnectionPoolModule/ConnectionPool.swift @@ -283,12 +283,15 @@ public final class ConnectionPool< await self.run(in: &taskGroup) } } onCancel: { - let actions = self.stateBox.withLockedValue { state in - state.stateMachine.triggerForceShutdown() - } + self.triggerForceShutdown() + } + } - self.runStateMachineActions(actions) + public func triggerForceShutdown() { + let actions = self.stateBox.withLockedValue { state in + state.stateMachine.triggerForceShutdown() } + self.runStateMachineActions(actions) } // MARK: - Private Methods -