File tree Expand file tree Collapse file tree 1 file changed +2
-14
lines changed
Sources/GraphQL/Subscription Expand file tree Collapse file tree 1 file changed +2
-14
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ public class ConcurrentEventStream<Element>: EventStream<Element> {
3131extension AsyncThrowingStream {
3232 func mapStream< To> ( _ closure: @escaping ( Element ) throws -> To ) -> AsyncThrowingStream < To , Error > {
3333 return AsyncThrowingStream < To , Error > { continuation in
34- let task = Task {
34+ Task {
3535 do {
3636 for try await event in self {
3737 let newEvent = try closure ( event)
@@ -42,18 +42,12 @@ extension AsyncThrowingStream {
4242 continuation. finish ( throwing: error)
4343 }
4444 }
45-
46- continuation. onTermination = { @Sendable reason in
47- if case . cancelled = reason {
48- task. cancel ( )
49- }
50- }
5145 }
5246 }
5347
5448 func filterStream( _ isIncluded: @escaping ( Element ) throws -> Bool ) -> AsyncThrowingStream < Element , Error > {
5549 return AsyncThrowingStream < Element , Error > { continuation in
56- let task = Task {
50+ Task {
5751 do {
5852 for try await event in self {
5953 if try isIncluded ( event) {
@@ -65,12 +59,6 @@ extension AsyncThrowingStream {
6559 continuation. finish ( throwing: error)
6660 }
6761 }
68-
69- continuation. onTermination = { @Sendable reason in
70- if case . cancelled = reason {
71- task. cancel ( )
72- }
73- }
7462 }
7563 }
7664}
You can’t perform that action at this time.
0 commit comments