Fix reporting of wrong download as failed #4236
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
With archive.org down, taniwha's mods hosted only there (before KSP-CKAN/NetKAN#10262 and KSP-CKAN/NetKAN#10263), and the life boat modpack depending on Extraplanetary Launchpads, our failed downloads handling has been undergoing a comprehensive stress test.
KSP-CKAN/NetKAN#10262's validation log reported a download failure for KIS, after reporting that KIS downloaded successfully:
https://github.com/KSP-CKAN/NetKAN/actions/runs/11407171543/job/31743515317
Meanwhile KerbalStats is downloading from the unavailable archive.org and just disappears from the log. That's the mod that actually failed to download.
Cause
NetAsyncDownloader
reports download failures by throwingDownloadErrorsKraken
which contains index/exception pairs, where the index is supposed to correspond to the original list ofDownloadTarget
s that was passed in. However, the index it actually uses comes from the internal array ofDownloadPart
s, which is built in the order that the downloads are started, which will not be the same as the targets if there is a mix of hosts. So the calling code gets scrambled info when trying to understand the exception.Changes
Now
DownloadErrorsKraken
contains pairs ofDownloadTarget
s and exceptions, which both come directly from the sameDownloadPart
object that had the failure. No indexes are involved anymore, so there's nothing to confuse. All calling code is updated to examine the target objects where it previously looked at the indexes.