summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/Config.md3
-rw-r--r--pkg/config/user_config.go10
-rw-r--r--pkg/gui/gui.go7
3 files changed, 17 insertions, 3 deletions
diff --git a/docs/Config.md b/docs/Config.md
index 3d3d5cfb1..2663336c4 100644
--- a/docs/Config.md
+++ b/docs/Config.md
@@ -51,6 +51,9 @@ Default path for the config file:
allBranchesLogCmd: "git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium"
overrideGpg: false # prevents lazygit from spawning a separate process when using GPG
disableForcePushing: false
+ refresher:
+ refreshInterval: 10 # file/submodule refresh interval in seconds
+ fetchInterval: 60 # re-fetch interval in seconds
update:
method: prompt # can be: prompt | background | never
days: 14 # how often an update is checked for
diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go
index ffdd93a8d..9d77dbdee 100644
--- a/pkg/config/user_config.go
+++ b/pkg/config/user_config.go
@@ -4,6 +4,7 @@ type UserConfig struct {
Gui GuiConfig `yaml:"gui"`
Git GitConfig `yaml:"git"`
Update UpdateConfig `yaml:"update"`
+ Refresher RefresherConfig `yaml:"refresher"`
Reporting string `yaml:"reporting"`
SplashUpdatesIndex int `yaml:"splashUpdatesIndex"`
ConfirmOnQuit bool `yaml:"confirmOnQuit"`
@@ -17,6 +18,11 @@ type UserConfig struct {
NotARepository string `yaml:"notARepository"`
}
+type RefresherConfig struct {
+ RefreshInterval int `yaml:"refreshInterval"`
+ FetchInterval int `yaml:"fetchInterval"`
+}
+
type GuiConfig struct {
ScrollHeight int `yaml:"scrollHeight"`
ScrollPastBottom bool `yaml:"scrollPastBottom"`
@@ -306,6 +312,10 @@ func GetDefaultConfig() *UserConfig {
DisableForcePushing: false,
CommitPrefixes: map[string]CommitPrefixConfig(nil),
},
+ Refresher: RefresherConfig{
+ RefreshInterval: 10,
+ FetchInterval: 60,
+ },
Update: UpdateConfig{
Method: "prompt",
Days: 14,
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go
index 5cc7dd5b3..b0d430fc6 100644
--- a/pkg/gui/gui.go
+++ b/pkg/gui/gui.go
@@ -495,7 +495,7 @@ func (gui *Gui) Run() error {
go utils.Safe(gui.startBackgroundFetch)
}
- gui.goEvery(time.Second*10, gui.stopChan, gui.refreshFilesAndSubmodules)
+ gui.goEvery(time.Second*time.Duration(userConfig.Refresher.RefreshInterval), gui.stopChan, gui.refreshFilesAndSubmodules)
g.SetManager(gocui.ManagerFunc(gui.layout), gocui.ManagerFunc(gui.getFocusLayout()))
@@ -643,8 +643,9 @@ func (gui *Gui) goEvery(interval time.Duration, stop chan struct{}, function fun
func (gui *Gui) startBackgroundFetch() {
gui.waitForIntro.Wait()
isNew := gui.Config.GetIsNewRepo()
+ userConfig := gui.Config.GetUserConfig()
if !isNew {
- time.After(60 * time.Second)
+ time.After(time.Duration(userConfig.Refresher.FetchInterval) * time.Second)
}
err := gui.fetch(false)
if err != nil && strings.Contains(err.Error(), "exit status 128") && isNew {
@@ -653,7 +654,7 @@ func (gui *Gui) startBackgroundFetch() {
prompt: gui.Tr.NoAutomaticGitFetchBody,
})
} else {
- gui.goEvery(time.Second*60, gui.stopChan, func() error {
+ gui.goEvery(time.Second*time.Duration(userConfig.Refresher.FetchInterval), gui.stopChan, func() error {
err := gui.fetch(false)
return err
})