Skip to content

Commit

Permalink
Remove pool size option, set default to 15
Browse files Browse the repository at this point in the history
  • Loading branch information
Fauzyy committed May 6, 2020
1 parent 526b801 commit 741c892
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 24 deletions.
31 changes: 13 additions & 18 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ const (
GitlabWebhookSecretFlag = "gitlab-webhook-secret" // nolint: gosec
HidePrevPlanComments = "hide-prev-plan-comments"
LogLevelFlag = "log-level"
ParallelPlansPoolSize = "parallel-plans-pool-size"
PortFlag = "port"
RepoConfigFlag = "repo-config"
RepoConfigJSONFlag = "repo-config-json"
Expand All @@ -84,19 +83,18 @@ const (
WriteGitCredsFlag = "write-git-creds"

// NOTE: Must manually set these as defaults in the setDefaults function.
DefaultADBasicUser = ""
DefaultADBasicPassword = ""
DefaultCheckoutStrategy = "branch"
DefaultBitbucketBaseURL = bitbucketcloud.BaseURL
DefaultDataDir = "~/.atlantis"
DefaultGHHostname = "github.com"
DefaultGitlabHostname = "gitlab.com"
DefaultLogLevel = "info"
DefaultParallelPlansPoolSize = 10
DefaultPort = 4141
DefaultTFDownloadURL = "https://releases.hashicorp.com"
DefaultTFEHostname = "app.terraform.io"
DefaultVCSStatusName = "atlantis"
DefaultADBasicUser = ""
DefaultADBasicPassword = ""
DefaultCheckoutStrategy = "branch"
DefaultBitbucketBaseURL = bitbucketcloud.BaseURL
DefaultDataDir = "~/.atlantis"
DefaultGHHostname = "github.com"
DefaultGitlabHostname = "gitlab.com"
DefaultLogLevel = "info"
DefaultPort = 4141
DefaultTFDownloadURL = "https://releases.hashicorp.com"
DefaultTFEHostname = "app.terraform.io"
DefaultVCSStatusName = "atlantis"
)

var stringFlags = map[string]stringFlag{
Expand Down Expand Up @@ -293,10 +291,6 @@ var boolFlags = map[string]boolFlag{
},
}
var intFlags = map[string]intFlag{
ParallelPlansPoolSize: {
description: "Max size of the wait group that runs parallel plans (if enabled).",
defaultValue: DefaultParallelPlansPoolSize,
},
PortFlag: {
description: "Port to bind to.",
defaultValue: DefaultPort,
Expand Down Expand Up @@ -400,6 +394,7 @@ func (s *ServerCmd) Init() *cobra.Command {
// Set int flags.
for name, f := range intFlags {
usage := f.description
fmt.Printf("default value: %v", f.defaultValue)
if f.defaultValue != 0 {
usage = fmt.Sprintf("%s (default %d)", usage, f.defaultValue)
}
Expand Down
5 changes: 1 addition & 4 deletions server/events/command_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ type DefaultCommandRunner struct {
Logger logging.SimpleLogging
// AllowForkPRs controls whether we operate on pull requests from forks.
AllowForkPRs bool
// ParallelPlansPoolSize controls the size of the wait group used to run
// parallel plans (if enabled).
ParallelPlansPoolSize int
// AllowForkPRsFlag is the name of the flag that controls fork PR's. We use
// this in our error message back to the user on a forked PR so they know
// how to enable this functionality.
Expand Down Expand Up @@ -363,7 +360,7 @@ func (c *DefaultCommandRunner) runProjectCmdsParallel(cmds []models.ProjectComma
var results []models.ProjectResult
mux := &sync.Mutex{}

wg := sizedwaitgroup.New(c.ParallelPlansPoolSize)
wg := sizedwaitgroup.New(15)
for _, pCmd := range cmds {
pCmd := pCmd
var execute func()
Expand Down
1 change: 0 additions & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ func NewServer(userConfig UserConfig, config Config) (*Server, error) {
SilenceForkPRErrorsFlag: config.SilenceForkPRErrorsFlag,
SilenceVCSStatusNoPlans: userConfig.SilenceVCSStatusNoPlans,
DisableApplyAll: userConfig.DisableApplyAll,
ParallelPlansPoolSize: userConfig.ParallelPlansPoolSize,
ProjectCommandBuilder: &events.DefaultProjectCommandBuilder{
ParserValidator: validator,
ProjectFinder: &events.DefaultProjectFinder{},
Expand Down
1 change: 0 additions & 1 deletion server/user_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ type UserConfig struct {
GitlabWebhookSecret string `mapstructure:"gitlab-webhook-secret"`
HidePrevPlanComments bool `mapstructure:"hide-prev-plan-comments"`
LogLevel string `mapstructure:"log-level"`
ParallelPlansPoolSize int `mapstructure:"parallel-plans-pool-size"`
Port int `mapstructure:"port"`
RepoConfig string `mapstructure:"repo-config"`
RepoConfigJSON string `mapstructure:"repo-config-json"`
Expand Down

0 comments on commit 741c892

Please sign in to comment.