gui2/addon_manager: Re-read add-on versions after each update batch

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.
This commit is contained in:
Iris Morelle 2020-03-14 01:15:48 -03:00
parent 76ddd4ce99
commit a99ec54acc
2 changed files with 10 additions and 0 deletions

View file

@ -1,4 +1,7 @@
## Version 1.15.3+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).
## Version 1.15.3
### AI

View file

@ -704,6 +704,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;
}