Skip to content

Comments

[release/3.10] 修复 MultipleSourceVersionList 不会使用备用下载源的问题#5588

Merged
Glavo merged 1 commit intoHMCL-dev:release/3.10from
Glavo:backport/3.10/5585
Feb 20, 2026
Merged

[release/3.10] 修复 MultipleSourceVersionList 不会使用备用下载源的问题#5588
Glavo merged 1 commit intoHMCL-dev:release/3.10from
Glavo:backport/3.10/5585

Conversation

@Glavo
Copy link
Member

@Glavo Glavo commented Feb 20, 2026

@Glavo Glavo added the backport label Feb 20, 2026
@Glavo Glavo requested a review from Copilot February 20, 2026 14:55
@Glavo Glavo changed the title [release/3.10] 修复 MultipleSourceVersionList 不会使用备用下载源的问题 (#5585) [release/3.10] 修复 MultipleSourceVersionList 不会使用备用下载源的问题 Feb 20, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

该 PR 旨在修复 MultipleSourceVersionList 在主下载源刷新失败时无法正确切换到备用下载源的问题,以提高版本列表拉取的可靠性(release/3.10 backport)。

Changes:

  • 重写 MultipleSourceVersionList.refreshAsync(gameVersion, sourceIndex) 的任务编排逻辑,使失败时可以继续尝试后续 source。
  • 引入自定义 Task,通过 dependents/dependencies 组织“先尝试当前源,失败则递归尝试下一个源”的执行链。

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +63 to +75
public Collection<Task<?>> getDependents() {
return List.of(refreshTask);
}

@Override
public Collection<? extends Task<?>> getDependencies() {
return nextTask != null ? List.of(nextTask) : List.of();
}

@Override
public boolean isRelyingOnDependents() {
return false;
}
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

This task continues execution when the dependent refreshTask fails (isRelyingOnDependents() returns false), but AsyncTaskExecutor still records the dependent failure into this task's exception field. If a later source succeeds, this task can finish successfully while getException() remains non-null (from the first failed source), which can break APIs that assume exception == null on success (e.g., Task.whenComplete asserts this invariant). Consider restructuring so failed source attempts do not count as failing dependents of the returned task (e.g., wrap source refreshes in a subtask that never fails and reports success via its result, or move fallback logic into a single task that only throws on final failure).

Copilot uses AI. Check for mistakes.
@Glavo Glavo merged commit a1c9f1b into HMCL-dev:release/3.10 Feb 20, 2026
6 checks passed
@Glavo Glavo deleted the backport/3.10/5585 branch February 20, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant