minigalaxy icon indicating copy to clipboard operation
minigalaxy copied to clipboard

Add multiple downloads and document DownloadManager

Open jgerrish opened this issue 3 years ago • 5 comments

Thank you for this wonderful application. The work that has been put into language translations and the application is inspiring.

I wanted to fix issue 270 or 367 https://github.com/sharkwouter/minigalaxy/issues/270 https://github.com/sharkwouter/minigalaxy/issues/367

But these require some caching work to do properly. To start that work, I started documenting DownloadManager. It has some great download resume code in it. I cleaned up some small issues in it and added multiple game downloads. Below are the changes:

Add ability to download multiple games.

Add documentation and examples to Download and DownloadManager. Fix some concurrency bugs in DownloadManager. Make prepare_location and get_start_point_and_download_mode private in DownloadManager. Switch to using a PriorityQueue in DownloadManager. Add a logger to minigalaxy.

Thank you again and let me know if you want any changes in this PR.

Thanks,

Joshua Gerrish

jgerrish avatar Feb 07 '22 23:02 jgerrish

I'm sorry, upon further review of this PR, I realize there's a resource exhaustion bug in this code.

If the user starts four game downloads, there won't be any threads left for UI updates like refreshing icons.

I need to think about how to do this, maybe reserve a few threads for icons and other UI asset downloads. This is related to the other caching work.

I know the experience you provide to users is important. I'll withdraw this PR, feel free to close it.

I'll try to clean this up in my branch. Thank you for your time and have a great week.

Thanks,

Josh

jgerrish avatar Feb 08 '22 17:02 jgerrish

PR is fixed up, I've started work on issue #367, but I wanted to submit the changes in manageable pieces. Thank you for taking the time to review this.

jgerrish avatar Feb 09 '22 15:02 jgerrish

Thanks a lot for this PR, I really appreciate the work on documentation here. I'll need to find time to look into it properly, but I have done a quick test and it does not seem to cause issues. What I am noticing is that it is a bit chatty with debug information. Maybe you could make it like it react to the MG_DEBUG environment variable like in api.py.

I've also enabled tests for this PR and it seems flake8 found some issues with formatting.

sharkwouter avatar Feb 09 '22 17:02 sharkwouter

I tested this again and I think I found a bug. After I had done some downloads and waited for them to complete, then having the application open for a while and trying to install a game again. Clicking download doesn't do anything for any game anymore. Closing the Minigalaxy window also doesn't kill the process anymore. I think the download threads are getting stuck, but that doesn't explain why nothing is being added to the queue anymore.

sharkwouter avatar Feb 20 '22 11:02 sharkwouter

Just did another test where I started 7 downloads and 2 updates one after another. None of them seem to start. Something is going wrong here and I'm not sure what.

sharkwouter avatar Feb 20 '22 11:02 sharkwouter

I finally managed to merge this. Thanks for the work, sorry it took forever.

sharkwouter avatar Sep 19 '22 22:09 sharkwouter