1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-11-23 22:24:51 +02:00

Cleanup: don't pass refreshInterval to startBackgroundFilesRefresh

It has access to UserConfig, so it can easily get it from there. This is how we
do it for startBackgroundFetch too, so be consistent.
This commit is contained in:
Stefan Haller
2025-11-16 13:26:33 +01:00
parent aff6b642ea
commit 472b964da3

View File

@@ -43,7 +43,7 @@ func (self *BackgroundRoutineMgr) startBackgroundRoutines() {
if userConfig.Git.AutoRefresh {
refreshInterval := userConfig.Refresher.RefreshInterval
if refreshInterval > 0 {
go utils.Safe(func() { self.startBackgroundFilesRefresh(refreshInterval) })
go utils.Safe(self.startBackgroundFilesRefresh)
} else {
self.gui.c.Log.Errorf(
"Value of config option 'refresher.refreshInterval' (%d) is invalid, disabling auto-refresh",
@@ -92,10 +92,11 @@ func (self *BackgroundRoutineMgr) startBackgroundFetch() {
self.triggerFetch = self.goEvery(time.Second*time.Duration(userConfig.Refresher.FetchInterval), self.gui.stopChan, fetch)
}
func (self *BackgroundRoutineMgr) startBackgroundFilesRefresh(refreshInterval int) {
func (self *BackgroundRoutineMgr) startBackgroundFilesRefresh() {
self.gui.waitForIntro.Wait()
self.goEvery(time.Second*time.Duration(refreshInterval), self.gui.stopChan, func() error {
userConfig := self.gui.UserConfig()
self.goEvery(time.Second*time.Duration(userConfig.Refresher.RefreshInterval), self.gui.stopChan, func() error {
self.gui.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.FILES}})
return nil
})