add default time out for git operations (#6015)
This commit is contained in:
parent
681345dc99
commit
9e8cc3b18d
4 changed files with 9 additions and 0 deletions
|
@ -610,6 +610,7 @@ GC_ARGS =
|
||||||
|
|
||||||
; Operation timeout in seconds
|
; Operation timeout in seconds
|
||||||
[git.timeout]
|
[git.timeout]
|
||||||
|
DEFAULT = 360
|
||||||
MIGRATE = 600
|
MIGRATE = 600
|
||||||
MIRROR = 300
|
MIRROR = 300
|
||||||
CLONE = 300
|
CLONE = 300
|
||||||
|
|
|
@ -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/
|
- `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`)
|
## Git - Timeout settings (`git.timeout`)
|
||||||
|
- `DEFAUlT`: **360**: Git operations default timeout seconds.
|
||||||
- `MIGRATE`: **600**: Migrate external repositories timeout seconds.
|
- `MIGRATE`: **600**: Migrate external repositories timeout seconds.
|
||||||
- `MIRROR`: **300**: Mirror external repositories timeout seconds.
|
- `MIRROR`: **300**: Mirror external repositories timeout seconds.
|
||||||
- `CLONE`: **300**: Git clone from internal repositories timeout seconds.
|
- `CLONE`: **300**: Git clone from internal repositories timeout seconds.
|
||||||
|
|
|
@ -188,6 +188,8 @@ menu:
|
||||||
- `GC_ARGS`: 执行 `git gc` 命令的参数, 比如: `--aggressive --auto`。
|
- `GC_ARGS`: 执行 `git gc` 命令的参数, 比如: `--aggressive --auto`。
|
||||||
|
|
||||||
## Git - 超时设置 (`git.timeout`)
|
## Git - 超时设置 (`git.timeout`)
|
||||||
|
|
||||||
|
- `DEFAUlT`: **360**: Git操作默认超时时间,单位秒
|
||||||
- `MIGRATE`: **600**: 迁移外部仓库时的超时时间,单位秒
|
- `MIGRATE`: **600**: 迁移外部仓库时的超时时间,单位秒
|
||||||
- `MIRROR`: **300**: 镜像外部仓库的超时时间,单位秒
|
- `MIRROR`: **300**: 镜像外部仓库的超时时间,单位秒
|
||||||
- `CLONE`: **300**: 内部仓库间克隆的超时时间,单位秒
|
- `CLONE`: **300**: 内部仓库间克隆的超时时间,单位秒
|
||||||
|
|
|
@ -526,6 +526,7 @@ var (
|
||||||
MaxGitDiffFiles int
|
MaxGitDiffFiles int
|
||||||
GCArgs []string `delim:" "`
|
GCArgs []string `delim:" "`
|
||||||
Timeout struct {
|
Timeout struct {
|
||||||
|
Default int
|
||||||
Migrate int
|
Migrate int
|
||||||
Mirror int
|
Mirror int
|
||||||
Clone int
|
Clone int
|
||||||
|
@ -539,12 +540,14 @@ var (
|
||||||
MaxGitDiffFiles: 100,
|
MaxGitDiffFiles: 100,
|
||||||
GCArgs: []string{},
|
GCArgs: []string{},
|
||||||
Timeout: struct {
|
Timeout: struct {
|
||||||
|
Default int
|
||||||
Migrate int
|
Migrate int
|
||||||
Mirror int
|
Mirror int
|
||||||
Clone int
|
Clone int
|
||||||
Pull int
|
Pull int
|
||||||
GC int `ini:"GC"`
|
GC int `ini:"GC"`
|
||||||
}{
|
}{
|
||||||
|
Default: int(git.DefaultCommandExecutionTimeout / time.Second),
|
||||||
Migrate: 600,
|
Migrate: 600,
|
||||||
Mirror: 300,
|
Mirror: 300,
|
||||||
Clone: 300,
|
Clone: 300,
|
||||||
|
@ -1142,6 +1145,8 @@ func NewContext() {
|
||||||
log.Fatal(4, "Failed to map Metrics settings: %v", err)
|
log.Fatal(4, "Failed to map Metrics settings: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
git.DefaultCommandExecutionTimeout = time.Duration(Git.Timeout.Default) * time.Second
|
||||||
|
|
||||||
sec = Cfg.Section("mirror")
|
sec = Cfg.Section("mirror")
|
||||||
Mirror.MinInterval = sec.Key("MIN_INTERVAL").MustDuration(10 * time.Minute)
|
Mirror.MinInterval = sec.Key("MIN_INTERVAL").MustDuration(10 * time.Minute)
|
||||||
Mirror.DefaultInterval = sec.Key("DEFAULT_INTERVAL").MustDuration(8 * time.Hour)
|
Mirror.DefaultInterval = sec.Key("DEFAULT_INTERVAL").MustDuration(8 * time.Hour)
|
||||||
|
|
Reference in a new issue