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

Caching and changeset fixes #3881

Merged
merged 1 commit into from Aug 16, 2023

Conversation

HebaruSan
Copy link
Member

@HebaruSan HebaruSan commented Aug 15, 2023

Background

  • If you click the download to cache option, a download progress screen appears, and then the whole mod list is regenerated just to keep the is:cached and not:cached filters updated
  • If you click the purge from cache option, the is:cached and not:cached filters are not updated

Problems

  • If you select to install some mods and then download or purge them, the changeset will show out of date information regarding whether they're cached
  • It is inconsistent that downloading to cache updates the filters but purging from cache doesn't, given how similar these options otherwise are
  • Regenerating the mod list after the download finishes is more work than necessary simply to keep the filters updated

Causes

  • The changeset tab was (re)generating its visual list only when the underlying changeset data changed, and downloading or purging a mod left the old text unchanged

Changes

Core:

  • Static method GroupByDownloads from Support multiple download URLs per module #3877 is moved from NetAsyncModulesDownloader to CkanModule because it can have uses outside of downloading
    • The inner loop is refactored into OneDownloadGroupingPass, which is used to implement a new instance method GetDownloadsGroup that returns all mods in the given sequence that share a download ZIP with the current mod, without generating the other groups

GUI:

  • The changeset tab now (re)generates the visual list when it is activated, to ensure the entries are always up to date with the currently cached mods
  • The download to cache option and the purge from cache option both now use CkanModule.GetDownloadsGroup to update the cached status of all the mods that share a download ZIP with the selected mod
  • The purge from cache right click menu now updates filters, so the affected mods will disappear if is:cached is active
  • The download to cache option now simply updates the filters instead of regenerating the entire GUI mod list, which will be quicker
  • GUI.ModList's constructor no longer accepts a handler for its ModFiltersUpdated event; it's now a normal event, so calling code is updated to add handlers as needed, which will mean less jumping around the code to understand this aspect during maintenance.
    • The event no longer passes the ModList object as a parameter because calling code would already have access to it by virtue of subscribing to the event in the first place

@HebaruSan HebaruSan added Bug Enhancement GUI Issues affecting the interactive GUI Core (ckan.dll) Issues affecting the core part of CKAN labels Aug 15, 2023
Copy link
Member

@techman83 techman83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great QoL improvement, thanks @HebaruSan !

@HebaruSan HebaruSan merged commit 1a884fe into KSP-CKAN:master Aug 16, 2023
10 checks passed
@HebaruSan HebaruSan deleted the fix/gui-cached-filter-on-purge branch August 16, 2023 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Core (ckan.dll) Issues affecting the core part of CKAN Enhancement GUI Issues affecting the interactive GUI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants