Skip to content

High 'idle' CPU usage caused by rendering spinner of background fetch #4734

@reivilibre

Description

@reivilibre

Describe the bug
I noticed my laptop getting hot when I'm not 'doing' anything and realised lazygit is sitting at 60% CPU usage in the background.

I did a perf top -p <PID> and noticed it is spending a lot of CPU time rerendering the screen.

Image

I then noticed that in the corner lazygit is displaying the 'Fetching /' spinner, which updates quite quickly.

This repository has SSH remotes that are not always reachable, so the fetching spinner pretty much stays on all the time.

To Reproduce
Steps to reproduce the behaviour:

  1. Add a git remote that is slow to fetch for some reason (e.g. by being offline, without any appropriate timeout)
  2. Launch lazygit
  3. Observe 'Fetching' spinner and high idle CPU usage

Expected behaviour

Not being so CPU intensive for a background task, I guess

Could also consider a config option to disable fetching from non-origin remotes for example.

Workaround

This setting makes the spinner update very slowly which more or less works around the problem:

gui:
  spinner:
    rate: 5000

(default is 50 ms)

Alternatively, the background fetch mechanism could be disabled in the config.

Screenshots
If applicable, add screenshots to help explain your problem.

Version info:

commit=, build date=, build source=nix, version=0.51.1, os=linux, arch=amd64, git version=2.49.0

git version 2.49.0

Additional context
Add any other context about the problem here.

Note: please try updating to the latest version or manually building the latest master to see if the issue still occurs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions