diff options
Diffstat (limited to 'internal/gitaly/config/ruby.go')
-rw-r--r-- | internal/gitaly/config/ruby.go | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/internal/gitaly/config/ruby.go b/internal/gitaly/config/ruby.go index 0392a31d7..92fa70c60 100644 --- a/internal/gitaly/config/ruby.go +++ b/internal/gitaly/config/ruby.go @@ -4,31 +4,33 @@ import ( "fmt" "path/filepath" "time" + + "gitlab.com/gitlab-org/gitaly/v15/internal/helper/duration" ) // Ruby contains setting for Ruby worker processes type Ruby struct { - Dir string `toml:"dir"` - MaxRSS int `toml:"max_rss"` - GracefulRestartTimeout time.Duration `toml:"graceful_restart_timeout"` - RestartDelay time.Duration `toml:"restart_delay"` - NumWorkers int `toml:"num_workers"` - LinguistLanguagesPath string `toml:"linguist_languages_path"` - RuggedGitConfigSearchPath string `toml:"rugged_git_config_search_path"` + Dir string `toml:"dir"` + MaxRSS int `toml:"max_rss"` + GracefulRestartTimeout duration.Duration `toml:"graceful_restart_timeout"` + RestartDelay duration.Duration `toml:"restart_delay"` + NumWorkers int `toml:"num_workers"` + LinguistLanguagesPath string `toml:"linguist_languages_path"` + RuggedGitConfigSearchPath string `toml:"rugged_git_config_search_path"` } // ConfigureRuby validates the gitaly-ruby configuration and sets default values. func (cfg *Cfg) ConfigureRuby() error { - if cfg.Ruby.GracefulRestartTimeout == 0 { - cfg.Ruby.GracefulRestartTimeout = 10 * time.Minute + if cfg.Ruby.GracefulRestartTimeout.Duration() == 0 { + cfg.Ruby.GracefulRestartTimeout = duration.Duration(10 * time.Minute) } if cfg.Ruby.MaxRSS == 0 { cfg.Ruby.MaxRSS = 200 * 1024 * 1024 } - if cfg.Ruby.RestartDelay == 0 { - cfg.Ruby.RestartDelay = 5 * time.Minute + if cfg.Ruby.RestartDelay.Duration() == 0 { + cfg.Ruby.RestartDelay = duration.Duration(5 * time.Minute) } if len(cfg.Ruby.Dir) == 0 { |