[PR #1715] [MERGED] launcher: remove a version on a background thread #3709

Closed
opened 2026-11-03 04:11:35 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1715
Author: @ludovic111
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/25/2026
Merged by: @ludovic111

Base: main ← Head: fix/launcher-remove-async


📝 Commits (1)

  • 87f377b launcher: remove a version on a background thread

📊 Changes

2 files changed (+69 additions, -9 deletions)

View changed files

📝 launcher/src/backend.rs (+2 -0)
📝 launcher/src/main.rs (+67 -9)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Fixes kevennever's Discord report (launcher 0.2.5, game 0.2.49, Windows): clicking "Remove" on an installed version froze the whole launcher for several seconds.

Cause: Launcher::remove called backend::remove_version (a remove_dir_all over the whole version folder) on the UI thread.

Fix (launcher/src/main.rs, launcher/src/backend.rs):

  • remove now spawns a thread and the result comes back as Msg::Removed(tag, Result), like Msg::Installed.
  • The tag is taken out of installed at once, so Play, the picker, prepare, server and mods can't use a version that is half deleted. A removing field marks it; the Versions row shows an indeterminate bar and "Removing…" instead of the buttons.
  • A second Remove, or an Install / update of the same tag, is refused while it is being removed (also while that tag is installing). Removed re-reads installed, restores the selection (newest left if the removed one was selected) and shows the error on the row if the deletion failed (e.g. a file the game still holds on Windows).
  • CLI (cli.rs Remove) is a blocking command already and still calls backend::remove_version: no change.

Tested

  • Unit test: the_selection_survives_a_removal_or_moves_to_the_newest_left.
  • Real launcher in scratch folders (fresh HORIZON_HOME / HORIZON_LAUNCHER_HOME / XDG_*, no self-update, no audio) with a fake installed v0.2.49 of 90,000 files (352 MB) next to v0.2.48, and a throw-away patch (not in the PR) that triggers the removal 6 s after start and logs the time remove() holds the UI thread:
    • before: remove() returned after 12384 ms
    • after: remove() returned after 0 ms; the folder was gone 11 s later, settings.json selection moved to v0.2.48, no error.
  • Not captured: screenshots. The Mac mini's screen session is locked, so screencapture sees only the lock screen; I could not show the "Removing…" row. Worth a look on a machine with a screen.

Self-check

  • cd launcher && cargo test / cargo clippy --all-targets -- -D warnings: pass.
  • python3 tools/pr_ready.py: launcher rustfmt, clippy, tests (118 passed) pass; no parity harness affected.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/1715 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/launcher-remove-async` --- ### 📝 Commits (1) - [`87f377b`](https://github.com/horizon-rust/horizon/commit/87f377b29cc885757c95d71e2e65bc0454bf8898) launcher: remove a version on a background thread ### 📊 Changes **2 files changed** (+69 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `launcher/src/backend.rs` (+2 -0) 📝 `launcher/src/main.rs` (+67 -9) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Fixes kevennever's Discord report (launcher 0.2.5, game 0.2.49, Windows): clicking "Remove" on an installed version froze the whole launcher for several seconds. **Cause:** `Launcher::remove` called `backend::remove_version` (a `remove_dir_all` over the whole version folder) on the UI thread. **Fix** (`launcher/src/main.rs`, `launcher/src/backend.rs`): - `remove` now spawns a thread and the result comes back as `Msg::Removed(tag, Result)`, like `Msg::Installed`. - The tag is taken out of `installed` at once, so Play, the picker, prepare, server and mods can't use a version that is half deleted. A `removing` field marks it; the Versions row shows an indeterminate bar and "Removing…" instead of the buttons. - A second Remove, or an Install / update of the same tag, is refused while it is being removed (also while that tag is installing). `Removed` re-reads `installed`, restores the selection (newest left if the removed one was selected) and shows the error on the row if the deletion failed (e.g. a file the game still holds on Windows). - CLI (`cli.rs` `Remove`) is a blocking command already and still calls `backend::remove_version`: no change. **Tested** - Unit test: `the_selection_survives_a_removal_or_moves_to_the_newest_left`. - Real launcher in scratch folders (fresh HORIZON_HOME / HORIZON_LAUNCHER_HOME / XDG_*, no self-update, no audio) with a fake installed `v0.2.49` of 90,000 files (352 MB) next to `v0.2.48`, and a throw-away patch (not in the PR) that triggers the removal 6 s after start and logs the time `remove()` holds the UI thread: - before: `remove() returned after 12384 ms` - after: `remove() returned after 0 ms`; the folder was gone 11 s later, `settings.json` selection moved to `v0.2.48`, no error. - Not captured: screenshots. The Mac mini's screen session is locked, so `screencapture` sees only the lock screen; I could not show the "Removing…" row. Worth a look on a machine with a screen. **Self-check** - `cd launcher && cargo test` / `cargo clippy --all-targets -- -D warnings`: pass. - `python3 tools/pr_ready.py`: launcher rustfmt, clippy, tests (118 passed) pass; no parity harness affected. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:11:35 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#3709
No description provided.