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

[Enhancement suggestion] Purge old downloads from cache #2438

Closed
JesusTheBird opened this issue May 4, 2018 · 5 comments
Closed

[Enhancement suggestion] Purge old downloads from cache #2438

JesusTheBird opened this issue May 4, 2018 · 5 comments
Labels
Core (ckan.dll) Issues affecting the core part of CKAN Enhancement New features or functionality

Comments

@JesusTheBird
Copy link

I think it would be great when a mod updates to a newer version of ksp(a version the player has currently installed) ckan should delete the older version from ..\Kerbal Space Program\CKAN\downloads folder, replacing it with the version that is installed alongside with the currently installed version of ksp.

Issue: I see at least two different versions of many mods in my ckan downloads folder, and all ive been doing is updating mods to new versions when I see them available. it looks like ckan doesn't touch the older versions of mods once a newer version is installed alongside an updated version of ksp.

Since Ckan can point to multiple ksp installs, a decision should be made if: Can I use this with multiple KSP installs at the same time(lets say I have 1.4.3 and 1.3.2 installed in different directories)? Can the settings be set based off what ksp version im currently using(we obviously don't want 1.4+ mods installing to a 1.3.0-2 just like that, or mods simply not appearing at all for a 1.3 install when you also have 1.4+ available )

Thank you!! I'm glad I could help!

Background

CKAN Version: 1.25.1

KSP Version: 1.4.3

Operating System: Windows 10 x64

@HebaruSan HebaruSan added the Enhancement New features or functionality label May 4, 2018
@HebaruSan
Copy link
Member

This would be nice to do after all instances share a cache (see #2185). I picture it as a checkbox setting with a name like "Auto-purge old mods from cache," possibly on by default since turning it off seems like the more power-user thing to do. It might also be desirable to allow users to specify a maximum cache size; e.g., if you say to limit the cache to 500 MB, then once we get over that limit we start deleting files till we're back under the limit (presumably we delete the oldest incompatible file first, then the rest of the incompatibles, then the oldest compatible, and so on). Might have to think about what would happen if a user specified 0 MB; would things break?

We could loop through all the instances and check their versions to identify out of date downloads (though we would want to check the chosen compatible versions list rather than just the actual game version). I would think any download where the highest KSP version is older than the user's oldest game instance could be deleted safely. Registry.GetSha1Index could be used to map from cache entries to their CkanModules quickly.

When to do it though? Startup? Shutdown? Install? Refresh?

@DasSkelett
Copy link
Member

That sounds nice 👍 .
I think the "tidy up" process would be best after install, because that's when we would hit the cache limit. "Delete all incompatible entries" should be called everytime after install, whereas the other deletions then depend on cache > limit

@politas
Copy link
Member

politas commented May 14, 2018

Definitely need a checkbox in settings to allow this option to be turned off if implemented. I have never deleted a mod from my cache and don't intend to!

@politas politas added the Core (ckan.dll) Issues affecting the core part of CKAN label May 14, 2018
@politas
Copy link
Member

politas commented May 14, 2018

Would also be good to throw a dialog box asking users to confirm they want this on after they auto-upgrade, so people aren't caught by surprise. IE, if the setting doesn't exist in the CKAN settings, prompt rather than force it on. Or default to the pre-existing behaviour.

@JesusTheBird
Copy link
Author

JesusTheBird commented May 30, 2018 via email

@HebaruSan HebaruSan changed the title when mods update to new ksp vers. Ckan Deletes old version folders [Enhancement suggestion] Purge old downloads from cache Aug 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core (ckan.dll) Issues affecting the core part of CKAN Enhancement New features or functionality
Projects
None yet
Development

No branches or pull requests

4 participants