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

Download queue missing update fix #450

Merged

Conversation

martinek
Copy link
Contributor

This PR tries to fix #446

By moving websocket updates to periodically polled updater, some updates (last) might get lost since they are not polled before notifyFlow is cleared. I believe this is caused by behavior of sample function.

@Syer10 I believe you did the downloader rework. Would something like this be correct way to fix it?

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.

It looks fine for the most part.

I think you are using immediate in too many places though, it doesn't need to be in re-order or unqueue as well as most of the download functions. Maybe just when one is added and when its finished.

…DownloadManager.kt

Co-authored-by: Mitchell Syer <Mitchellptbo@gmail.com>
@martinek
Copy link
Contributor Author

I think you are using immediate in too many places though, it doesn't need to be in re-order or unqueue as well as most of the download functions. Maybe just when one is added and when its finished.

I was not sure when the bug can appear.

I was thinking about another solution, which would probably be better (more robust). Though I don't know if I fully understand the bug.

It happens when notifyFlow is destroyed before last update is sent to clients. Is there a place where this happens (where notifyFlow is being destroyed)? Since the sample(1) is called from init of DownloadManager, maybe it happens when DownloadManager is being cleaned up from memory or something? I don't understand when notifyFlow is disposed. Could we manually call the update then? That would probably fix all the possible cases.

@martinek
Copy link
Contributor Author

@Syer10 After the discussion we had on Discord, I have removed most of the immediate updates. I have left in immediat notification:

  • when downloads are added
  • when download state changes to Downloading
  • when download state changes to Finished

I have also reverted the change from yesterday. Lets keep the immediate notifications in same thread to make sure the data sent to clients are current ones.

@AriaMoradi AriaMoradi merged commit e7cb88c into Suwayomi:master Nov 16, 2022
@martinek martinek deleted the fix/download-queue-missing-updates branch November 16, 2022 20:28
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.

[Bug] Downloads Web socket is not throwing Finished State for a chapter after chapter downloaded
3 participants