Skip to content

Commit

Permalink
withTimeout should cancel all tasks on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Nov 3, 2023
1 parent ada5cfe commit c027f35
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Sources/HummingbirdXCT/TestHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public func withTimeout<T>(timeout: Duration, _ process: @escaping @Sendable ()
try await Task.sleep(for: timeout)
throw TimeoutError()
}
defer {
group.cancelAll()
}
return try await group.next()!
}
}
Expand Down

0 comments on commit c027f35

Please sign in to comment.