Skip to content

Commit

Permalink
slack-vitess-r12.0.5: allow conn overrides in consul topo
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Vaillancourt <[email protected]>
  • Loading branch information
timvaillancourt committed Jul 26, 2023
1 parent 87cb1d3 commit 72c35db
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions go/vt/topo/consultopo/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,15 @@ import (
)

var (
defaultTransportConfig = api.DefaultConfig().Transport
consulAuthClientStaticFile = flag.String("consul_auth_static_file", "", "JSON File to read the topos/tokens from.")
// serfHealth is the default check from consul
consulLockSessionChecks = flag.String("topo_consul_lock_session_checks", "serfHealth", "List of checks for consul session.")
consulLockSessionTTL = flag.String("topo_consul_lock_session_ttl", "", "TTL for consul session.")
consulLockDelay = flag.Duration("topo_consul_lock_delay", 15*time.Second, "LockDelay for consul session.")
consulMaxConnsPerHost = flag.Int("topo_consul_max_conns_per_host", defaultTransportConfig.MaxConnsPerHost, "Maximum number of consul connections per host.")
consulMaxIdleConns = flag.Int("topo_consul_max_idle_conns", defaultTransportConfig.MaxIdleConns, "Maximum number of idle consul connections.")
consulIdleConnTimeout = flag.Duration("topo_consul_idle_conn_timeout", defaultTransportConfig.IdleConnTimeout, "Maximum amount of time to pool idle connections.")
)

// ClientAuthCred credential to use for consul clusters
Expand Down Expand Up @@ -130,6 +134,10 @@ func NewServer(cell, serverAddr, root string) (*Server, error) {
}
}

cfg.Transport.MaxConnsPerHost = *consulMaxConnsPerHost
cfg.Transport.MaxIdleConns = *consulMaxIdleConns
cfg.Transport.IdleConnTimeout = *consulIdleConnTimeout

client, err := api.NewClient(cfg)
if err != nil {
return nil, err
Expand Down

0 comments on commit 72c35db

Please sign in to comment.