GermanBread / declarative-flatpak

126 stars 4 forks source link

Optimize bandwidth usage #12

Closed Spaghetto392 closed 1 year ago

Spaghetto392 commented 1 year ago

When manage-system-flatpaks.service is run, it redownloads every program specified in configuration.nix. This normally isn't necessary and is potentially harmful to users with a limited bandwidth cap, as often the only change between a previous run and a new run is perhaps a number of programs needing to be updated.

I believe the easiest way to alleviate this would be to first copy any programs that are already installed that are also still referenced in configuration.nix and then to simply run flatpak update on them. After running this operation, running flatpak install should skip all packages that are already present. This could also potentially greatly increase the speed at which the script is able to complete after the initial run as it won't have to download redundant packages. EDIT: formatting.

GermanBread commented 1 year ago

Hi, sorry for my late response. I was incredibly busy.

I implemented your suggestion. You can enable it with a new option I added.

The feature is disabled by default.

Spaghetto392 commented 1 year ago

Just finished testing. Seems to work well. I did have a problem when I changed the post-init commands where the script re-downloaded everything again from Flathub, but I'm not quite sure if that issue is related, and it hasn't occurred since.

Spaghetto392 commented 8 months ago

Hey, @GermanBread . I was just curious if there are plans to re-implement recycling of generations as a feature. I learned recently that I've exceeded my bandwidth limit multiple times the last few months.

Due to the amount of Flatpaks I have installed, every time manage-system-flatpaks.service runs, it downloads about 8.5 GBs of data. I turn off my computer each night and start it again the next day, causing a new download of 8.5 GBs of data each day of the month. In total meaning I'm downloading about 255 GBs of potentially unneeded data each month, which is about a quarter of my allowed bandwidth.

I'm also worried about the unnecessary strain it is potentially putting on Flathub and other services.

If it is possible, I would greatly appreciate it.

GermanBread commented 8 months ago

Recycling is too difficult for me to implement without rewriting the whole install script in a good language like any sane person would do. If you need that feature I suggest you check out this repo

Spaghetto392 commented 8 months ago

@GermanBread Thank you for your response. I'll check out the repo you sent. Even if I do end up switching, I wish you luck with this project, and if you do ever decide to re-implement that feature (unfortunately needed for me.) I'll be sure to check it out.