From 567e5a0e225e3bb8f2d5dec00c36fd4fdd9a5d7a Mon Sep 17 00:00:00 2001 From: Nedyalko Andreev Date: Wed, 11 Mar 2020 14:09:01 +0200 Subject: [PATCH] Move the default gracefulStop value to a variable --- lib/executor/base_config.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/executor/base_config.go b/lib/executor/base_config.go index 32547b3bb8a..45823625d06 100644 --- a/lib/executor/base_config.go +++ b/lib/executor/base_config.go @@ -30,6 +30,11 @@ import ( null "gopkg.in/guregu/null.v3" ) +// DefaultGracefulStopValue is the graceful top value for all executors, unless +// it's manually changed by the gracefulStop in each one. +// TODO?: Discard? Or make this actually user-configurable somehow? hello #883... +var DefaultGracefulStopValue = 30 * time.Second //nolint:gochecknoglobals + var executorNameWhitelist = regexp.MustCompile(`^[0-9a-zA-Z_-]+$`) //nolint:gochecknoglobals const executorNameErr = "the executor name should contain only numbers, latin letters, underscores, and dashes" @@ -42,7 +47,7 @@ type BaseConfig struct { Env map[string]string `json:"env"` Exec null.String `json:"exec"` // function name, externally validated - //TODO: future extensions like tags, distribution, others? + // TODO: future extensions like tags, distribution, others? } // NewBaseConfig returns a default base config with the default values @@ -50,7 +55,7 @@ func NewBaseConfig(name, configType string) BaseConfig { return BaseConfig{ Name: name, Type: configType, - GracefulStop: types.NewNullDuration(30*time.Second, false), + GracefulStop: types.NewNullDuration(DefaultGracefulStopValue, false), } }