diff --git a/Sources/AblyChat/RoomLifecycleManager.swift b/Sources/AblyChat/RoomLifecycleManager.swift index f8d1308c..433456fd 100644 --- a/Sources/AblyChat/RoomLifecycleManager.swift +++ b/Sources/AblyChat/RoomLifecycleManager.swift @@ -539,7 +539,7 @@ internal actor DefaultRoomLifecycleManager + typealias Continuation = CheckedContinuation, Never> private var operationResultContinuationsByOperationID: [UUID: [Continuation]] = [:] @@ -585,11 +585,11 @@ internal actor DefaultRoomLifecycleManager) { + private func operationWithID(_ operationID: UUID, didCompleteWithResult result: Result) { logger.log(message: "Operation \(operationID) completed with result \(result)", level: .debug) let continuationsToResume = operationResultContinuations.removeContinuationsForResultOfOperationWithID(operationID) for continuation in continuationsToResume { - continuation.resume(with: result) + continuation.resume(returning: result) } } @@ -622,16 +624,18 @@ internal actor DefaultRoomLifecycleManager( + private func performAnOperation( forcingOperationID forcedOperationID: UUID?, - _ body: (UUID) async throws(Failure) -> Void - ) async throws(Failure) { + _ body: (UUID) async throws(ARTErrorInfo) -> Void + ) async throws(ARTErrorInfo) { let operationID = forcedOperationID ?? UUID() logger.log(message: "Performing operation \(operationID)", level: .debug) - let result: Result + let result: Result do { // My understanding (based on what the compiler allows me to do, and a vague understanding of how actors work) is that inside this closure you can write code as if it were a method on the manager itself — i.e. with synchronous access to the manager’s state. But I currently lack the Swift concurrency vocabulary to explain exactly why this is the case. try await body(operationID) @@ -660,12 +664,12 @@ internal actor DefaultRoomLifecycleManager