Skip to content

Commit

Permalink
gui2/addon_manager: Re-read add-on versions after each update batch
Browse files Browse the repository at this point in the history
The Update All codepath is unique in that it doesn't trigger a re-read
of add-on versions until the very end, once the full run has completed.
The problem with this is that install_addon_with_checks() may update
dependencies of individual add-ons in the process, resulting in
redundant downloads of any affected add-ons if the player isn't paying
attention.

Address this by triggering a re-read of add-on versions after every
single update batch that results in a download.

Closes #3273.
  • Loading branch information
irydacea committed Mar 30, 2020
1 parent 62c9aec commit 484d959
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions changelog.md
@@ -1,4 +1,7 @@
## Version 1.14.11+dev
### Add-ons client
* Ensure the client doesn't re-download dependencies that have just been updated during an Update All
run by re-reading add-on versions after each update batch (issue #3273).
### Language and i18n
* Updated translations: Czech, Dutch, Esperanto, Finnish, French, Portuguese,
Portuguese (Brazil), Swedish.
Expand Down
7 changes: 7 additions & 0 deletions src/gui/dialogs/addon/manager.cpp
Expand Up @@ -705,6 +705,13 @@ void addon_manager::update_all_addons(window& window)
if(tracking_info_[a.first].state == ADDON_INSTALLED_UPGRADABLE) {
addons_client::install_result result = client_.install_addon_with_checks(addons_, a.second);

if(result.wml_changed) {
// Updating an add-on may have resulted in its dependencies being updated
// as well, so we need to reread version info blocks afterwards to make sure
// we don't try to re-download newly updated add-ons.
refresh_addon_version_info_cache();
}

// Take note if any wml_changes occurred
need_wml_cache_refresh_ |= result.wml_changed;
}
Expand Down

0 comments on commit 484d959

Please sign in to comment.