Skip to content

Commit

Permalink
Don't even start projecting, if task in chunk is cancelled
Browse files Browse the repository at this point in the history
  • Loading branch information
nighthawk committed Oct 29, 2024
1 parent 3985921 commit f504b75
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/GeoDrawer/GeoDrawer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ extension GeoDrawer {
let added = group.addTaskUnlessCancelled {
await Task {
return chunk.compactMap { input in
project(input.element).flatMap { OffsettedElement(offset: input.offset, element: $0) }
guard !Task.isCancelled, let projected = project(input.element) else { return nil }
return OffsettedElement(offset: input.offset, element: projected)
}
}.value
}
Expand Down

0 comments on commit f504b75

Please sign in to comment.