Skip to content

Commit

Permalink
Move the default gracefulStop value to a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
na-- committed Mar 11, 2020
1 parent 5051580 commit 567e5a0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/executor/base_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -42,15 +47,15 @@ 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
func NewBaseConfig(name, configType string) BaseConfig {
return BaseConfig{
Name: name,
Type: configType,
GracefulStop: types.NewNullDuration(30*time.Second, false),
GracefulStop: types.NewNullDuration(DefaultGracefulStopValue, false),
}
}

Expand Down

0 comments on commit 567e5a0

Please sign in to comment.