-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linked connector not restoring after iCloud restore #1013
Linked connector not restoring after iCloud restore #1013
Conversation
@@ -88,6 +89,7 @@ public struct RestoreProfileFromBackupCoordinator: Sendable, FeatureReducer { | |||
state.profileSelection = .init(snapshot: profileSnapshot, isInCloud: isInCloud) | |||
return .run { send in | |||
try? await clock.sleep(for: .milliseconds(300)) | |||
try await radixConnectClient.connectToP2PLinks(profileSnapshot.appPreferences.p2pLinks) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cant remember now, but what are we infact awaiting here? looks wrong? This mean that send(.internal(.delay..(.importMnemonicsFlow))
event is not emitted until radixConnectClient.connectToP2PLinks
has finished? So what happens if you quit Chrome and redo your demo in the video? Will this RestoreProfileFromBackupCoordinator
reducer wait forever until connected? Or are we using unstructured concurrency inside connectToP2PLinks
ensuring it will not be 'blocking"? Otherwise, perhaps this try await
inside this run
must change, e.g. to a run {}.concat {}
or whatever the syntax is block, or possible even Task
(unstructured concurrency)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this RestoreProfileFromBackupCoordinator reducer wait forever until connected?
No, connectToP2PLinks
calls the try await rtcClients.connect(password, waitsForConnectionToBeEstablished: false)
. if waitsForConnectionToBeEstablished == false
there is no actual async code path:
public func connect(
_ linkPassword: ConnectionPassword,
waitsForConnectionToBeEstablished: Bool = false
) async throws {
guard !clients.contains(where: { $0.key == linkPassword }) else {
loggerGlobal.notice("Ignored connecting RTCClient with connectionPassword/id: \(linkPassword), since it is already in RTCClients.clients")
return
}
let client = try makeRTCClient(linkPassword)
if waitsForConnectionToBeEstablished {
try await client.waitForFirstConnection()
}
add(client)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Connect to the P2PLinks during the profile Restore from Backup flow.
Changes
Demo
Screen.Recording.2024-01-31.at.08.35.01.mov