flexo icon indicating copy to clipboard operation
flexo copied to clipboard

Cleaning package cache based on access time

Open nroi opened this issue 4 years ago • 4 comments

Flexo already provides the possibility to automatically clean the package cache by retaining not more than x versions. However, it can still happen that a package is downloaded once by a client, and then uninstalled by the client, so that the package now remains in the cache indefinitely even though no client needs it anymore.

paccache provides the -u, --uninstalled flag for this use case, but we cannot provide something similar for Flexo, because Flexo runs on a server, so it doesn't know which packages are installed by the various clients that are using Flexo.

As a workaround, we should give the user the possibility to define something like the following in the configuration file:

retain_for_duration = "9 months"

So that Flexo will remove all packages older than the given duration, even if that means that fewer than num_versions_retain versions are retained in the cache.

We are already using the humantime library to parse human-readable durations, so implementing this should be easy.

If this option is not defined in the configuration file, the default should be to not delete any packages based on the access time.

nroi avatar Jun 06 '21 08:06 nroi

If you implement this option you can consider the auto refresh option after that. ;)

ivdimitro avatar Dec 17 '21 20:12 ivdimitro

If you implement this option you can consider the auto refresh option after that. ;)

What do you mean by "auto refresh option"?

nroi avatar Dec 18 '21 10:12 nroi

If I had to make a guess, I'm guessing they want an option for flexo to automatically download package updates every configurable amount of time (without installing them)

WTechNinja avatar Feb 21 '22 07:02 WTechNinja

If I had to make a guess, I'm guessing they want an option for flexo to automatically download package updates every configurable amount of time (without installing them)

I thought about that, and decided to not implement this for different reasons. One reason is that this would cause unnecessary traffic on the mirrors because some packages are updated much more often than they are installed. For example, if a package is updated from version 1 to 2 and then 3, Flexo might download all three versions, but pacman might upgrade from 1 to 3 without ever downloading version 2. This is wasteful and something that I want to avoid, especially since the mirrors are provided by volunteers. Another reason is that Flexo does not know which packages are required by the client. Just because a package has been downloaded in the past does not mean that a newer version of this package will also be downloaded. The user might have installed the package, tried it out, and immediately decided to uninstall it.

nroi avatar Feb 21 '22 18:02 nroi