The window freezes while git runs #4

Open
opened 2026-10-15 13:26:33 +00:00 by szaman · 0 comments
Owner

Found in the final review of the branch feature/remote-ssh. The problem is older than that branch: it is in every release so far.

What happens

While git runs, the gites window does not respond: no scrolling, no clicks, no keys. With a small local repository on Linux this lasts a few milliseconds, so nobody notices. It gets long when:

  • the repository is large, so git log takes a while;
  • the system is Windows, where starting a program is slow (this probably added to the "very slow" report in #2);
  • git runs on another machine over ssh (branch feature/remote-ssh). Every command then waits for the network, a server that does not answer freezes the window for up to 10 seconds, and a connection that died while the laptop slept could freeze it for minutes.

gites reloads the repository every time its window gets focus, and a reload runs git several times, so the freeze happens often.

Why

The Rust functions the window calls (load_repo, open_repo, commit_details, file_diff in src-tauri/src/lib.rs) are declared as plain #[tauri::command] fn. Tauri 2 runs such commands on the main thread, the same thread that draws the window. Each of them runs git and waits for it to finish.

Fix

Run these commands on another thread: #[tauri::command(async)]. They already return Result, which Tauri needs for this. For ssh, also add -o ServerAliveInterval=5 -o ServerAliveCountMax=2, so a dead connection is noticed in about 10 seconds.

The fix is being made on the branch feature/remote-ssh.

Found in the final review of the branch `feature/remote-ssh`. The problem is older than that branch: it is in every release so far. ## What happens While git runs, the gites window does not respond: no scrolling, no clicks, no keys. With a small local repository on Linux this lasts a few milliseconds, so nobody notices. It gets long when: - the repository is large, so `git log` takes a while; - the system is Windows, where starting a program is slow (this probably added to the "very slow" report in #2); - git runs on another machine over ssh (branch `feature/remote-ssh`). Every command then waits for the network, a server that does not answer freezes the window for up to 10 seconds, and a connection that died while the laptop slept could freeze it for minutes. gites reloads the repository every time its window gets focus, and a reload runs git several times, so the freeze happens often. ## Why The Rust functions the window calls (`load_repo`, `open_repo`, `commit_details`, `file_diff` in `src-tauri/src/lib.rs`) are declared as plain `#[tauri::command] fn`. Tauri 2 runs such commands on the main thread, the same thread that draws the window. Each of them runs git and waits for it to finish. ## Fix Run these commands on another thread: `#[tauri::command(async)]`. They already return `Result`, which Tauri needs for this. For ssh, also add `-o ServerAliveInterval=5 -o ServerAliveCountMax=2`, so a dead connection is noticed in about 10 seconds. The fix is being made on the branch `feature/remote-ssh`.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: szaman/gites#4