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

Send every download status change to the subscriber #684

Conversation

schroda
Copy link
Collaborator

@schroda schroda commented Sep 16, 2023

Flow::stateIn has "Strong equality-based conflation" (see documentation). Thus, it omits every value in case it's equal to the previous one. Since the DownloadManger::getStatus function returns a status with a queue, that contains all current "DownloadChapters" by reference, the equality check was always true. Thus, progress changes of downloads were never sent to subscribers. Subscriber were only notified about finished downloads (size of queue changed) or downloader status changes

Flow::stateIn has "Strong equality-based conflation" (see documentation).
Thus, it omits every value in case it's equal to the previous one.
Since the DownloadManger::getStatus function returns a status with a queue, that contains all current "DownloadChapters" by reference, the equality check was always true.
Thus, progress changes of downloads were never sent to subscribers.
Subscriber were only notified about finished downloads (size of queue changed) or downloader status changes
Copy link
Collaborator

@Syer10 Syer10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to work with a StateFlow, but I see that DownloadChapter isn't a data class like I thought it was. We would need to rewrite it quite a bit for it to work like how I like it.

@Syer10 Syer10 merged commit c9423ef into Suwayomi:master Sep 16, 2023
2 checks passed
@schroda schroda deleted the fix/graphql_download_subscription_not_sending_progress_changes branch September 16, 2023 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants