Skip to content

Commit 472b964

Browse files
committed
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.
1 parent aff6b64 commit 472b964

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/gui/background.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (self *BackgroundRoutineMgr) startBackgroundRoutines() {
4343
if userConfig.Git.AutoRefresh {
4444
refreshInterval := userConfig.Refresher.RefreshInterval
4545
if refreshInterval > 0 {
46-
go utils.Safe(func() { self.startBackgroundFilesRefresh(refreshInterval) })
46+
go utils.Safe(self.startBackgroundFilesRefresh)
4747
} else {
4848
self.gui.c.Log.Errorf(
4949
"Value of config option 'refresher.refreshInterval' (%d) is invalid, disabling auto-refresh",
@@ -92,10 +92,11 @@ func (self *BackgroundRoutineMgr) startBackgroundFetch() {
9292
self.triggerFetch = self.goEvery(time.Second*time.Duration(userConfig.Refresher.FetchInterval), self.gui.stopChan, fetch)
9393
}
9494

95-
func (self *BackgroundRoutineMgr) startBackgroundFilesRefresh(refreshInterval int) {
95+
func (self *BackgroundRoutineMgr) startBackgroundFilesRefresh() {
9696
self.gui.waitForIntro.Wait()
9797

98-
self.goEvery(time.Second*time.Duration(refreshInterval), self.gui.stopChan, func() error {
98+
userConfig := self.gui.UserConfig()
99+
self.goEvery(time.Second*time.Duration(userConfig.Refresher.RefreshInterval), self.gui.stopChan, func() error {
99100
self.gui.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.FILES}})
100101
return nil
101102
})

0 commit comments

Comments
 (0)