Skip to content

Commit

Permalink
Re-ordered scenario 11 calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
jackgene authored Dec 22, 2024
1 parent 1b5b711 commit 47514cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion swift-async/Sources/EasyRacer/EasyRacer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ public struct EasyRacer {
let result: String? = await withTaskGroup(of: String?.self) { group in
defer { group.cancelAll() }

group.addTask { try? await urlSession.bodyText(from: url) }
group.addTask {
await withTaskGroup(of: String?.self) { subgroup in
subgroup.addTask { try? await urlSession.bodyText(from: url) }
Expand All @@ -307,6 +306,7 @@ public struct EasyRacer {
return await subgroup.first { $0 != nil }.flatMap { $0 }
}
}
group.addTask { try? await urlSession.bodyText(from: url) }

return await group.first { $0 != nil }.flatMap { $0 }
}
Expand Down

0 comments on commit 47514cc

Please sign in to comment.