Skip to content

Commit b922920

Browse files
author
Chris Chapman
committed
Handling multiple flags for concurrency
1 parent 2127d93 commit b922920

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

pkg/consuldp/consul_dataplane.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,18 @@ func (cdp *ConsulDataplane) Run(ctx context.Context) error {
208208
}
209209

210210
func (cdp *ConsulDataplane) envoyProxyConfig(cfg []byte) envoy.ProxyConfig {
211-
// Translate the concurrency parameter to the envoy parameter.
212-
concurrency := fmt.Sprintf("--concurrency %v", cdp.cfg.Envoy.EnvoyConcurrency)
213-
// Prepend so that if the consumer also specifies a concurrency level their specification should take
214-
// precedence.
215-
extraArgs := append([]string{concurrency}, cdp.cfg.Envoy.ExtraArgs...)
211+
setConcurrency := true
212+
extraArgs := cdp.cfg.Envoy.ExtraArgs
213+
// Users could set the concurrency as an extra args. Take that as priority for best ux
214+
// experience.
215+
for _, v := range extraArgs {
216+
if v == "--concurrency" {
217+
setConcurrency = false
218+
}
219+
}
220+
if setConcurrency {
221+
extraArgs = append(extraArgs, fmt.Sprintf("--concurrency %v", cdp.cfg.Envoy.EnvoyConcurrency))
222+
}
216223

217224
return envoy.ProxyConfig{
218225
Logger: cdp.logger,

0 commit comments

Comments
 (0)