a36e58c964
* Increase number to test ignore. Consul Enterprise has more flags and since we are trying to reduce the differences between both code bases, we are increasing the number in oss. The semantics don't change, it is just a cosmetic thing. * Introduce agent.initEnterprise for enterprise related hooks. * Sync test with ent version. * Fix import order. * revert error wording.
45 lines
1.1 KiB
Go
45 lines
1.1 KiB
Go
package lib
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/hashicorp/serf/serf"
|
|
)
|
|
|
|
// SerfDefaultConfig returns a Consul-flavored Serf default configuration,
|
|
// suitable as a basis for a LAN, WAN, segment, or area.
|
|
func SerfDefaultConfig() *serf.Config {
|
|
base := serf.DefaultConfig()
|
|
|
|
// This effectively disables the annoying queue depth warnings.
|
|
base.QueueDepthWarning = 1000000
|
|
|
|
// This enables dynamic sizing of the message queue depth based on the
|
|
// cluster size.
|
|
base.MinQueueDepth = 4096
|
|
|
|
// This gives leaves some time to propagate through the cluster before
|
|
// we shut down. The value was chosen to be reasonably short, but to
|
|
// allow a leave to get to over 99.99% of the cluster with 100k nodes
|
|
// (using https://www.serf.io/docs/internals/simulator.html).
|
|
base.LeavePropagateDelay = 3 * time.Second
|
|
|
|
return base
|
|
}
|
|
|
|
func GetSerfTags(serf *serf.Serf) map[string]string {
|
|
tags := make(map[string]string)
|
|
for tag, value := range serf.LocalMember().Tags {
|
|
tags[tag] = value
|
|
}
|
|
|
|
return tags
|
|
}
|
|
|
|
func UpdateSerfTag(serf *serf.Serf, tag, value string) {
|
|
tags := GetSerfTags(serf)
|
|
tags[tag] = value
|
|
|
|
serf.SetTags(tags)
|
|
}
|