Skip to content

Commit

Permalink
chore: kickoff release
Browse files Browse the repository at this point in the history
  • Loading branch information
lawmicha authored Jun 4, 2024
2 parents 2a233c4 + ad53816 commit 4d16007
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,16 @@ actor AppSyncRealTimeClient: AppSyncRealTimeClientProtocol {
.eraseToAnyPublisher()
}

private func reconnect() async {
do {
log.debug("[AppSyncRealTimeClient] Reconnecting")
await disconnect()
try await connect()
} catch {
log.debug("[AppSyncRealTimeClient] Failed to reconnect, error: \(error)")
}
}

private static func decodeAppSyncRealTimeResponseError(_ data: JSONValue?) -> [Error] {
let knownAppSyncRealTimeRequestErorrs =
Self.decodeAppSyncRealTimeRequestError(data)
Expand Down Expand Up @@ -414,7 +424,7 @@ extension AppSyncRealTimeClient {
.sink(receiveValue: {
self.log.debug("[AppSyncRealTimeClient] KeepAlive timed out, disconnecting")
Task { [weak self] in
await self?.disconnect()
await self?.reconnect()
}.toAnyCancellable.store(in: &self.cancellables)
})
.store(in: &cancellablesBindToConnection)
Expand Down

0 comments on commit 4d16007

Please sign in to comment.