From 5158800bbeb253b24aa7fccb913ae0433860c1e3 Mon Sep 17 00:00:00 2001 From: RandomYang Date: Mon, 30 Sep 2024 18:16:30 +0800 Subject: [PATCH 1/2] fix: forget to call continuation.finish() causing task suspension --- Sources/EventSource/EventSource.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/EventSource/EventSource.swift b/Sources/EventSource/EventSource.swift index bda50be..80c93d6 100644 --- a/Sources/EventSource/EventSource.swift +++ b/Sources/EventSource/EventSource.swift @@ -182,6 +182,7 @@ public extension EventSource { cancel() if previousState == .open { continuation.yield(.closed) + continuation.finish() } } @@ -213,6 +214,7 @@ public extension EventSource { func sendErrorEvent(with error: Error) { continuation.yield(.error(error)) + continuation.finish() } } } From 717bcb6d419d2670300b7e6e514ad2e3828147de Mon Sep 17 00:00:00 2001 From: RandomYang Date: Fri, 4 Oct 2024 00:23:24 +0800 Subject: [PATCH 2/2] chore: rm useless .finish call --- Sources/EventSource/EventSource.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Sources/EventSource/EventSource.swift b/Sources/EventSource/EventSource.swift index 80c93d6..8a2a252 100644 --- a/Sources/EventSource/EventSource.swift +++ b/Sources/EventSource/EventSource.swift @@ -214,7 +214,6 @@ public extension EventSource { func sendErrorEvent(with error: Error) { continuation.yield(.error(error)) - continuation.finish() } } }