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> {
31
31
extension AsyncThrowingStream {
32
32
func mapStream< To> ( _ closure: @escaping ( Element ) throws -> To ) -> AsyncThrowingStream < To , Error > {
33
33
return AsyncThrowingStream < To , Error > { continuation in
34
- let task = Task {
34
+ Task {
35
35
do {
36
36
for try await event in self {
37
37
let newEvent = try closure ( event)
@@ -42,18 +42,12 @@ extension AsyncThrowingStream {
42
42
continuation. finish ( throwing: error)
43
43
}
44
44
}
45
-
46
- continuation. onTermination = { @Sendable reason in
47
- if case . cancelled = reason {
48
- task. cancel ( )
49
- }
50
- }
51
45
}
52
46
}
53
47
54
48
func filterStream( _ isIncluded: @escaping ( Element ) throws -> Bool ) -> AsyncThrowingStream < Element , Error > {
55
49
return AsyncThrowingStream < Element , Error > { continuation in
56
- let task = Task {
50
+ Task {
57
51
do {
58
52
for try await event in self {
59
53
if try isIncluded ( event) {
@@ -65,12 +59,6 @@ extension AsyncThrowingStream {
65
59
continuation. finish ( throwing: error)
66
60
}
67
61
}
68
-
69
- continuation. onTermination = { @Sendable reason in
70
- if case . cancelled = reason {
71
- task. cancel ( )
72
- }
73
- }
74
62
}
75
63
}
76
64
}
You can’t perform that action at this time.
0 commit comments