Skip to content

Initial delay for autoFetch not applied to recent repositories #4083

@gwolves

Description

@gwolves

Describe the bug
I suspect this line is intended to introduce an initial delay before autoFetch for recently used repositories:

if !isNew {
time.After(time.Duration(userConfig.Refresher.FetchInterval) * time.Second)
}

However, since time.After returns a channel, the correct implementation should be:

 if !isNew { 
 	<-time.After(time.Duration(userConfig.Refresher.FetchInterval) * time.Second) 
 } 

As a result, there is no initial delay before autoFetch starts.

To Reproduce
Steps to reproduce the behavior:

  1. Open LazyGit on a recently used repository.
  2. Observe that autoFetch runs immediately.

Expected behavior
The first autoFetch should occur after refresher.fetchInterval, assuming my interpretation is correct.

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

Version info:
commit=, build date=, build source=nix, version=0.44.1, os=darwin, arch=arm64, git version=2.46.0
git version 2.46.0

Additional context
Add any other context about the problem here.

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