Skip to content

Conversation

@burningtnt
Copy link
Member

@burningtnt burningtnt commented Dec 20, 2025

原来的码太狗屎了,竟然会保留全部模组的全部历史版本待查,怪不得这么容易 OOM

该 PR 必须在 #5026 后合并,否则会 DOS 服务器

@burningtnt burningtnt marked this pull request as draft December 20, 2025 13:01
@burningtnt burningtnt marked this pull request as ready for review December 20, 2025 14:29
@Glavo Glavo requested a review from Copilot January 16, 2026 12:39
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

This PR fixes issue #4958 by addressing an Out-Of-Memory (OOM) problem in the mod update checking functionality. The original implementation retained all historical versions of all mods during update checks, causing excessive memory usage.

Changes:

  • Refactored ModUpdate to store a single candidate version instead of a list of all newer versions
  • Consolidated mod update checking logic to reduce the number of concurrent tasks and memory footprint
  • Updated UI code to reference the single candidate version instead of selecting from a list

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
HMCLCore/src/main/java/org/jackhuang/hmcl/mod/LocalModFile.java Changed ModUpdate to store single candidate version; checkUpdates() now returns only the most recent version
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModCheckUpdatesTask.java Refactored to create one task per mod (instead of per mod-repository pair) and select the newest update internally
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModUpdatesPage.java Updated references from getCandidates().get(0) to getCandidate()
Comments suppressed due to low confidence (1)

HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModCheckUpdatesTask.java:81

  • The task returns false for isRelyingOnDependents() but still calls isDependentsSucceeded() logic implicitly through the result collection in execute(). This is inconsistent with the pattern seen in other tasks. When isRelyingOnDependents() is false, tasks typically need to explicitly check dependent task success. However, since the current implementation filters null results (which would be returned on failure), this works correctly but could be clearer. Consider adding a comment explaining why returning false is safe here, or ensure the pattern is consistent with how other tasks handle dependent failures.
    public boolean isRelyingOnDependents() {
        return false;
    }

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

@Glavo Glavo merged commit 9ca95c7 into HMCL-dev:main Jan 16, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants