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

Proportional, granular progress updates for installing #4055

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

HebaruSan
Copy link
Member

Motivation

  • There are no UI updates while a mod is being installed, which can take a long time for a very large mod and may make it look like the GUI is frozen
  • The progress bar for installing mods treats tiny mods and huge mods as an equal percentage of the install, which makes it useless for estimating how complete the install actually is
  • The mod installation progress bar counts up from 0% to 60% for the actual unzipping, and then the remaining 40% reflects saving the registry (which became a lot faster in Refactor repository and available module handling #3904) and completing the transaction (which is basically instantaneous), which likewise makes the progress bar less reflective of overall completion

Changes

  • Now we generate at least one progress update per file being unzipped, and another progress update every 200 milliseconds after that for large files, so large mods will have many gradual updates to the progress bar, and you'll be able to tell that it's still installing
  • Now installation progress updates are scaled proportionally to the number of bytes installed, so the progress bar will reflect how far along you are in the overall install
  • Now mod installation is given 85% of the progress bar, with saving the registry and finishing the transaction relegated to the remaining 15%

Fixes #4014.

Side fixes

  • The timer from Trigger progress updates for frozen downloads #4052 was continuing to run and generate spurious updates after downloads completed. Now it's properly destroyed.
  • ModuleInstaller.onReportModInstalled is now a proper event, and its type is Action<CkanModule> instead of a custom delegate
  • ModuleInstaller.InstallModule formerly returned IEnumerable<string>, which isn't a great idea for a collection that's going to be passed to other functions because IEnumerable<> often involves lazy evaluation, which may cause performance problems if evaluated multiple times. Now it's a List<string>.
  • ModuleInstaller.ksp is renamed to instance

@HebaruSan HebaruSan added Enhancement New features or functionality GUI Issues affecting the interactive GUI labels Mar 11, 2024
@HebaruSan HebaruSan force-pushed the feature/install-progress branch from 29e0f89 to 35f0ae6 Compare March 11, 2024 19:54
@HebaruSan HebaruSan merged commit 232f578 into KSP-CKAN:master Mar 11, 2024
8 checks passed
@HebaruSan HebaruSan deleted the feature/install-progress branch March 11, 2024 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New features or functionality GUI Issues affecting the interactive GUI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Installing large mods can cause the UI to appear to hang for a while
1 participant