Skip to content

Commit

Permalink
Link the SUSPENDED status to a RETRY operation
Browse files Browse the repository at this point in the history
This is to allow us to make the tests for the upcoming RETRY operation
more realistic. Our initial implementation of the RETRY operation won’t
actually put the room into the SUSPENDED status, though; I’ll figure out
the right place to do that once we actually trigger this operation
internally in #50.
  • Loading branch information
lawrence-forooghian committed Nov 14, 2024
1 parent 6e2e7e8 commit ec1645a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Sources/AblyChat/RoomLifecycleManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ internal actor DefaultRoomLifecycleManager<Contributor: RoomLifecycleContributor
case attached
case detaching(detachOperationID: UUID)
case detached
case suspended(error: ARTErrorInfo)
case suspended(retryOperationID: UUID, error: ARTErrorInfo)
case failed(error: ARTErrorInfo)
case releasing(releaseOperationID: UUID)
case released
Expand All @@ -204,7 +204,7 @@ internal actor DefaultRoomLifecycleManager<Contributor: RoomLifecycleContributor
.detaching
case .detached:
.detached
case let .suspended(error):
case let .suspended(_, error):
.suspended(error: error)
case let .failed(error):
.failed(error: error)
Expand All @@ -223,8 +223,9 @@ internal actor DefaultRoomLifecycleManager<Contributor: RoomLifecycleContributor
detachOperationID
case let .releasing(releaseOperationID):
releaseOperationID
case .suspended,
.initialized,
case let .suspended(retryOperationID, _):
retryOperationID
case .initialized,
.attached,
.detached,
.failed,
Expand Down Expand Up @@ -462,7 +463,7 @@ internal actor DefaultRoomLifecycleManager<Contributor: RoomLifecycleContributor

clearTransientDisconnectTimeouts()

changeStatus(to: .suspended(error: reason))
changeStatus(to: .suspended(retryOperationID: UUID(), error: reason))
}
case .attaching:
if !hasOperationInProgress, !contributorAnnotations[contributor].hasTransientDisconnectTimeout {
Expand Down Expand Up @@ -706,7 +707,7 @@ internal actor DefaultRoomLifecycleManager<Contributor: RoomLifecycleContributor
case .suspended:
// CHA-RL1h2
let error = ARTErrorInfo(chatError: .attachmentFailed(feature: contributor.feature, underlyingError: contributorAttachError))
changeStatus(to: .suspended(error: error))
changeStatus(to: .suspended(retryOperationID: UUID(), error: error))

// CHA-RL1h3
throw error
Expand Down

0 comments on commit ec1645a

Please sign in to comment.