From c027f35df8e8a2b839306bffb4b4c32bc3e192ed Mon Sep 17 00:00:00 2001 From: Adam Fowler Date: Fri, 3 Nov 2023 12:09:13 +0000 Subject: [PATCH] withTimeout should cancel all tasks on exit --- Sources/HummingbirdXCT/TestHelpers.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sources/HummingbirdXCT/TestHelpers.swift b/Sources/HummingbirdXCT/TestHelpers.swift index 869720e5b..8b4166d24 100644 --- a/Sources/HummingbirdXCT/TestHelpers.swift +++ b/Sources/HummingbirdXCT/TestHelpers.swift @@ -31,6 +31,9 @@ public func withTimeout(timeout: Duration, _ process: @escaping @Sendable () try await Task.sleep(for: timeout) throw TimeoutError() } + defer { + group.cancelAll() + } return try await group.next()! } }