Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Sources/LiveKit/Support/AsyncCompleter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ actor CompleterMapActor<T: Sendable> {
final class AsyncCompleter<T: Sendable>: @unchecked Sendable, Loggable {
//
struct WaitEntry {
let continuation: UnsafeContinuation<T, Error>
let continuation: CheckedContinuation<T, Error>
let timeoutBlock: DispatchWorkItem

func cancel() {
Expand Down Expand Up @@ -123,6 +123,10 @@ final class AsyncCompleter<T: Sendable>: @unchecked Sendable, Loggable {

func resume(with result: Result<T, Error>) {
_lock.sync {
if let _result {
log("\(label) already resolved \(_entries) with \(_result)", .debug)
}

for entry in _entries.values {
entry.resume(with: result)
}
Expand Down Expand Up @@ -160,7 +164,7 @@ final class AsyncCompleter<T: Sendable>: @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 }
Expand Down
Loading