aboutsummaryrefslogtreecommitdiffstats
path: root/modules/setting
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-02-10 06:44:24 +0800
committerzeripath <art27@cantab.net>2019-02-09 22:44:24 +0000
commit9e8cc3b18da7438b315676686d6552926cc2965a (patch)
tree0c7a279ac271e923134a511d733261b9baafa5de /modules/setting
parent681345dc994fa52e6d137885ebdc1c95e1a4e2e1 (diff)
downloadgitea-9e8cc3b18da7438b315676686d6552926cc2965a.tar.gz
gitea-9e8cc3b18da7438b315676686d6552926cc2965a.zip
add default time out for git operations (#6015)
Diffstat (limited to 'modules/setting')
-rw-r--r--modules/setting/setting.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 42f1de425e..c878fbe92f 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -526,6 +526,7 @@ var (
MaxGitDiffFiles int
GCArgs []string `delim:" "`
Timeout struct {
+ Default int
Migrate int
Mirror int
Clone int
@@ -539,12 +540,14 @@ var (
MaxGitDiffFiles: 100,
GCArgs: []string{},
Timeout: struct {
+ Default int
Migrate int
Mirror int
Clone int
Pull int
GC int `ini:"GC"`
}{
+ Default: int(git.DefaultCommandExecutionTimeout / time.Second),
Migrate: 600,
Mirror: 300,
Clone: 300,
@@ -1142,6 +1145,8 @@ func NewContext() {
log.Fatal(4, "Failed to map Metrics settings: %v", err)
}
+ git.DefaultCommandExecutionTimeout = time.Duration(Git.Timeout.Default) * time.Second
+
sec = Cfg.Section("mirror")
Mirror.MinInterval = sec.Key("MIN_INTERVAL").MustDuration(10 * time.Minute)
Mirror.DefaultInterval = sec.Key("DEFAULT_INTERVAL").MustDuration(8 * time.Hour)