Merge pull request #1743 from ahoppen/withtimeout-issue

This commit is contained in:
Alex Hoppen
2024-10-08 21:58:11 -07:00
committed by GitHub
2 changed files with 1 additions and 2 deletions

View File

@@ -26,7 +26,6 @@ package func repeatUntilExpectedResult(
file: StaticString = #filePath,
line: UInt = #line
) async throws {
logger.info("x: \(Int(timeout.seconds / sleepInterval.seconds))")
for _ in 0..<Int(timeout.seconds / sleepInterval.seconds) {
if try await body() {
return

View File

@@ -189,8 +189,8 @@ package func withTimeout<T: Sendable>(
let timeoutTask = Task {
try await Task.sleep(for: duration)
bodyTask.cancel()
continuation.yield(with: .failure(TimeoutError()))
bodyTask.cancel()
}
mutableTasks = [bodyTask, timeoutTask]
}