diff --git a/Sources/LiveKit/Support/AsyncCompleter.swift b/Sources/LiveKit/Support/AsyncCompleter.swift index 0aaa7f862..6d4f259b3 100644 --- a/Sources/LiveKit/Support/AsyncCompleter.swift +++ b/Sources/LiveKit/Support/AsyncCompleter.swift @@ -66,7 +66,7 @@ actor CompleterMapActor { final class AsyncCompleter: @unchecked Sendable, Loggable { // struct WaitEntry { - let continuation: UnsafeContinuation + let continuation: CheckedContinuation let timeoutBlock: DispatchWorkItem func cancel() { @@ -123,6 +123,10 @@ final class AsyncCompleter: @unchecked Sendable, Loggable { func resume(with result: Result) { _lock.sync { + if let _result { + log("\(label) already resolved \(_entries) with \(_result)", .debug) + } + for entry in _entries.values { entry.resume(with: result) } @@ -160,7 +164,7 @@ final class AsyncCompleter: @unchecked Sendable, Loggable { // Create a cancel-aware timed continuation return try await withTaskCancellationHandler { - try await withUnsafeThrowingContinuation { continuation in + try await withCheckedThrowingContinuation { continuation in // Create time-out block let timeoutBlock = DispatchWorkItem { [weak self] in guard let self else { return }