Skip to content

Commit

Permalink
Plumb config
Browse files Browse the repository at this point in the history
  • Loading branch information
dadgar committed Jan 11, 2018
1 parent ec638f1 commit f27a7da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 1 addition & 3 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,7 @@ TRY:
}

// We can wait a bit and retry!
// TODO(alexdadgar): Plumb through the RPCHoldTimeout config
//if time.Since(firstCheck) < c.config.RPCHoldTimeout {
if time.Since(firstCheck) < 5*time.Second {
if time.Since(firstCheck) < c.config.RPCHoldTimeout {
jitter := lib.RandomStagger(5 * time.Second / nomad.JitterFraction)
select {
case <-time.After(jitter):
Expand Down
8 changes: 8 additions & 0 deletions client/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,13 @@ type Config struct {
// BackwardsCompatibleMetrics determines whether to show methods of
// displaying metrics for older verions, or to only show the new format
BackwardsCompatibleMetrics bool

// RPCHoldTimeout is how long an RPC can be "held" before it is errored.
// This is used to paper over a loss of leadership by instead holding RPCs,
// so that the caller experiences a slow response rather than an error.
// This period is meant to be long enough for a leader election to take
// place, and a small jitter is applied to avoid a thundering herd.
RPCHoldTimeout time.Duration
}

func (c *Config) Copy() *Config {
Expand Down Expand Up @@ -228,6 +235,7 @@ func DefaultConfig() *Config {
NoHostUUID: true,
DisableTaggedMetrics: false,
BackwardsCompatibleMetrics: false,
RPCHoldTimeout: 5 * time.Second,
}
}

Expand Down

0 comments on commit f27a7da

Please sign in to comment.