Skip to content

Commit 6fe18c3

Browse files
committed
Add cancellation for Array
1 parent 9c15c66 commit 6fe18c3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/Fork/ForkedArray.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,17 @@ extension ForkedArray {
104104
case let .single(value):
105105
guard try await filter(value) else { return [] }
106106

107+
try Task.checkCancellation()
108+
107109
return [try await using(value)]
108110
case let .fork(fork):
109111
return try await fork.merged(
110112
using: { leftType, rightType in
111113
async let leftOutput = try output(for: leftType, filter: filter, using: using)
112114
async let rightOutput = try output(for: rightType, filter: filter, using: using)
113115

116+
try Task.checkCancellation()
117+
114118
return try await leftOutput + rightOutput
115119
}
116120
)

0 commit comments

Comments
 (0)