Skip to content
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

AsyncOpen progress does not reflect the bootstrap change sets #8595

Closed
duncangroenewald opened this issue May 18, 2024 · 2 comments
Closed

Comments

@duncangroenewald
Copy link

How frequently does the bug occur?

-- select --

Description

The function below has been used successfully on partition based synced realms and correctly shows the sync progress when the client is bootstrapped.

However when used with a flexible synced realm this code more or less immediately returns 100% but then the bootstrap change sets haven't yet been downloaded and integrated.

How can we get the progress notifications for the bootstrap process to correctly show the initialisation progress to the app users ?

    func asyncRealmI(completion: @escaping (Realm?, Error?)->Void)->Realm.AsyncOpenTask {
        
        self.setSyncErrorHandler()
        
        let task = Realm.asyncOpen(configuration: self.realmSyncConfig, callbackQueue: .main) { result in
            
            switch result {
            case .failure(let error):
                DebugLog("MongoRealm asyncOpen failed: \(error.localizedDescription)")
                completion(nil, error)
                
            case .success(let realm):
                DebugLog("MongoRealm asyncOpen successfull")
                completion(realm, nil)
                return
                
            }
        }
        
        task.addProgressNotification(block: { syncProgress in
            DispatchQueue.main.async {
                let prog = syncProgress.fractionTransferred * 100.0
                DebugLog("Sync: \(prog.formatted0)%")
                GlobalVars.shared.downloadSyncProgress = prog
            }
        })
        
        return task
    }

Stacktrace & log output

No response

Can you reproduce the bug?

Always

Reproduction Steps

See above function to asyncOpen a flexible synced realm.

Version

10.42.4

What Atlas Services are you using?

Atlas Device Sync

Are you using encryption?

No

Platform OS and version(s)

macOS Sonoma

Build environment

Xcode version: 15.4
Dependency manager and version: Realm/RealmSwift frameworks built from source

Copy link

sync-by-unito bot commented May 18, 2024

➤ PM Bot commented:

Jira ticket: RCOCOA-2366

@nirinchev
Copy link
Member

You need to upgrade to latest Realm Swift to get correct progress notifications when using flexible sync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants