Skip to content

Regression with missing download progress notification for PBS #7627

@rorbech

Description

@rorbech

Expected results

Progress notifications for PSB seems to have changed when there is currently no known outstanding downloads.

In 14.5.1 and below it was possible to implement a quite simple "progress spinner"-experience with code like

val realm = Realm.open(...)
realm.syncSession.progressAsFlow(Direction.DOWNLOAD, ProgressMode.CURRENT_CHANGES)
    .onEach {
        // Display progress
    }
    .takeWhile { !it.isTransferComplete }

// Display downloaded content

If there were no remote updates since the app was opened last time, the progress notifier would fire an immediate event with transferableBytes == transferredBytes indicating that there was no immediate known ongoing download, and you could proceed to displaying the data.

The new behavior is not only a regression, but also seems to go against all other notifier registration points that actually posts an immediate callback of the initial state.

Actual Results

With v14.5.2-39-geef7fcf04 we are no longer getting a progress notification if all known things have been fully downloaded, so
neither

realm.syncSession.progressAsFlow(Direction.DOWNLOAD, ProgressMode.CURRENT_CHANGES)

nor

realm.syncSession.progressAsFlow(Direction.DOWNLOAD, ProgressMode.INDEFINITELY)

The actual tests showing the regression in Kotlin was https://github.com/realm/realm-kotlin/blob/main/packages/test-sync/src/commonTest/kotlin/io/realm/kotlin/test/mongodb/common/ProgressListenerTests.kt#L228.

Steps & Code to Reproduce

This Kotlin test is now failling with a timeout exception due to the missing callbacks.

Core version

Core version: v14.5.2-39-geef7fcf04

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions