Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ node_reconnect_timeout = "72h"
// update the coordinates for all nodes it is watching every 10 seconds.
node_probe_interval = "10s"

// The length of time to wait before updating the health status of a node.
// Note that the reaping process due to failed pings wont be triggered after
// the health status is updated, so if node_reconnect_timeout is lower than
// this parameter, it won't be triggered until this interval has expired.
node_health_refresh_interval = "1h"

// Controls whether or not to disable calculating and updating node coordinates
// when doing the node probe. Defaults to false i.e. coordinate updates
// are enabled.
Expand Down
6 changes: 4 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,9 @@ type HumanConfig struct {
KVPath flags.StringValue `mapstructure:"consul_kv_path"`
NodeMeta []map[string]string `mapstructure:"external_node_meta"`

NodeReconnectTimeout flags.DurationValue `mapstructure:"node_reconnect_timeout"`
NodeProbeInterval flags.DurationValue `mapstructure:"node_probe_interval"`
NodeReconnectTimeout flags.DurationValue `mapstructure:"node_reconnect_timeout"`
NodeProbeInterval flags.DurationValue `mapstructure:"node_probe_interval"`
NodeHealthRefreshInterval flags.DurationValue `mapstructure:"node_health_refresh_interval"`

HTTPAddr flags.StringValue `mapstructure:"http_addr"`
Token flags.StringValue `mapstructure:"token"`
Expand Down Expand Up @@ -468,6 +469,7 @@ func MergeConfig(dst *Config, src *HumanConfig) error {
}
src.NodeReconnectTimeout.Merge(&dst.NodeReconnectTimeout)
src.NodeProbeInterval.Merge(&dst.CoordinateUpdateInterval)
src.NodeHealthRefreshInterval.Merge(&dst.NodeHealthRefreshInterval)
src.HTTPAddr.Merge(&dst.HTTPAddr)
src.Token.Merge(&dst.Token)
src.Datacenter.Merge(&dst.Datacenter)
Expand Down
18 changes: 10 additions & 8 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ consul_service = "service"
consul_service_tag = "asdf"
consul_kv_path = "custom-esm/"
node_reconnect_timeout = "22s"
node_health_refresh_interval = "23s"
node_probe_interval = "12s"
external_node_meta {
a = "1"
Expand Down Expand Up @@ -75,14 +76,15 @@ log_json = true
`)

expected := &Config{
LogLevel: "INFO",
EnableDebug: true,
InstanceID: "test-instance-id",
Service: "service",
Tag: "asdf",
KVPath: "custom-esm/",
NodeReconnectTimeout: 22 * time.Second,
CoordinateUpdateInterval: 12 * time.Second,
LogLevel: "INFO",
EnableDebug: true,
InstanceID: "test-instance-id",
Service: "service",
Tag: "asdf",
KVPath: "custom-esm/",
NodeReconnectTimeout: 22 * time.Second,
NodeHealthRefreshInterval: 23 * time.Second,
CoordinateUpdateInterval: 12 * time.Second,
NodeMeta: map[string]string{
"a": "1",
"b": "2",
Expand Down