aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--custom/conf/app.ini.sample1
-rw-r--r--docs/content/doc/advanced/config-cheat-sheet.en-us.md1
-rw-r--r--docs/content/doc/advanced/config-cheat-sheet.zh-cn.md2
-rw-r--r--modules/setting/setting.go5
4 files changed, 9 insertions, 0 deletions
diff --git a/custom/conf/app.ini.sample b/custom/conf/app.ini.sample
index 8a25c66107..5ef4fa05bb 100644
--- a/custom/conf/app.ini.sample
+++ b/custom/conf/app.ini.sample
@@ -610,6 +610,7 @@ GC_ARGS =
; Operation timeout in seconds
[git.timeout]
+DEFAULT = 360
MIGRATE = 600
MIRROR = 300
CLONE = 300
diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md
index 3494311de9..b01f600b7c 100644
--- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md
+++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md
@@ -316,6 +316,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
- `GC_ARGS`: **\<empty\>**: Arguments for command `git gc`, e.g. `--aggressive --auto`. See more on http://git-scm.com/docs/git-gc/
## Git - Timeout settings (`git.timeout`)
+- `DEFAUlT`: **360**: Git operations default timeout seconds.
- `MIGRATE`: **600**: Migrate external repositories timeout seconds.
- `MIRROR`: **300**: Mirror external repositories timeout seconds.
- `CLONE`: **300**: Git clone from internal repositories timeout seconds.
diff --git a/docs/content/doc/advanced/config-cheat-sheet.zh-cn.md b/docs/content/doc/advanced/config-cheat-sheet.zh-cn.md
index 2f02513511..1181b8b411 100644
--- a/docs/content/doc/advanced/config-cheat-sheet.zh-cn.md
+++ b/docs/content/doc/advanced/config-cheat-sheet.zh-cn.md
@@ -188,6 +188,8 @@ menu:
- `GC_ARGS`: 执行 `git gc` 命令的参数, 比如: `--aggressive --auto`。
## Git - 超时设置 (`git.timeout`)
+
+- `DEFAUlT`: **360**: Git操作默认超时时间,单位秒
- `MIGRATE`: **600**: 迁移外部仓库时的超时时间,单位秒
- `MIRROR`: **300**: 镜像外部仓库的超时时间,单位秒
- `CLONE`: **300**: 内部仓库间克隆的超时时间,单位秒
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)