From 1410033c56da1f64f5d06a56d87c778f59b39d63 Mon Sep 17 00:00:00 2001 From: Marcus Ficner Date: Mon, 28 Mar 2022 17:15:02 +0200 Subject: [PATCH] Ensure that calling cancel() deallocates the subscription --- Sources/CombineLongPolling/LongPollingPublisher.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/CombineLongPolling/LongPollingPublisher.swift b/Sources/CombineLongPolling/LongPollingPublisher.swift index 999607c..021cf7c 100644 --- a/Sources/CombineLongPolling/LongPollingPublisher.swift +++ b/Sources/CombineLongPolling/LongPollingPublisher.swift @@ -76,6 +76,8 @@ extension LongPollingPublisher { lock.lock() finished = true lock.unlock() + // Make sure to not wait for the semaphore, otherwise the object won't get allocated + semaphore.signal() buffer?.complete(completion: .finished) currentRequest = nil