From 472b964da3cc362c48f410ef2f21cdb661b27352 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sun, 16 Nov 2025 13:26:33 +0100 Subject: [PATCH] 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. --- pkg/gui/background.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/gui/background.go b/pkg/gui/background.go index aa0726568..362c23c6f 100644 --- a/pkg/gui/background.go +++ b/pkg/gui/background.go @@ -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 })