Use fork merged in ForkedActor act

This commit is contained in:
Leif 2022-09-22 18:41:37 -06:00
parent 7682617694
commit b087274990
1 changed files with 2 additions and 7 deletions

View File

@ -36,13 +36,8 @@ public struct ForkedActor<Value: Actor> {
/// Asynchronously resolve the fork using the actor
@discardableResult
public func act() async throws -> Value {
try await Task.withCheckedCancellation {
async let leftForkedTask = fork.left()
async let rightForkedTask = fork.right()
_ = try await [leftForkedTask, rightForkedTask]
return actor
try await fork.merged { _, _ in
actor
}
}
}