beyond-all-reason / bar-lobby

BAR Lobby Client
https://beyond-all-reason.github.io/bar-lobby/
MIT License
33 stars 30 forks source link

Content APIs should remove old versions #197

Open Jazcash opened 1 year ago

Jazcash commented 1 year ago

Currently, there is no way to remove downloaded content other than deleting it from the filesystem. However, the map and game APIs don't handle this well because they store references to which content is installed in the db cache, and I don't believe they validate those entries against the filesystem to make sure they still exist.

First we need to make sure all content APIs stay synced with the actual files in the filesystem. Deleting a file from the cache should also delete it from the filesystem and vice-versa.

As for cleaning up old content, I suggest we store lastLaunched date for every version of engine/game/maps, which gets updated whenever the game API launched that content. Then we can set some configurable expiration time (e.g. 1 year), and periodically delete all content that hasn't been launched within that time (not replays ofc!). Maybe we don't want to do that for maps, but at the least we should delete old versions of maps when newer versions of them are installed, but should also consider maps downloaded to watch old replays.

Jazcash commented 1 year ago

Done for old engine versions, but can't do same for game versions until https://github.com/beyond-all-reason/pr-downloader/issues/21 is implemented