mirror of https://github.com/status-im/consul.git
dns: move ttl closer to usage
This commit is contained in:
parent
642fcd4611
commit
70be1ab635
20
agent/dns.go
20
agent/dns.go
|
@ -711,16 +711,6 @@ RPC:
|
|||
}
|
||||
}
|
||||
|
||||
// Determine the TTL
|
||||
var ttl time.Duration
|
||||
if d.config.ServiceTTL != nil {
|
||||
var ok bool
|
||||
ttl, ok = d.config.ServiceTTL[service]
|
||||
if !ok {
|
||||
ttl = d.config.ServiceTTL["*"]
|
||||
}
|
||||
}
|
||||
|
||||
// Filter out any service nodes due to health checks
|
||||
out.Nodes = out.Nodes.Filter(d.config.OnlyPassing)
|
||||
|
||||
|
@ -734,6 +724,16 @@ RPC:
|
|||
// Perform a random shuffle
|
||||
out.Nodes.Shuffle()
|
||||
|
||||
// Determine the TTL
|
||||
var ttl time.Duration
|
||||
if d.config.ServiceTTL != nil {
|
||||
var ok bool
|
||||
ttl, ok = d.config.ServiceTTL[service]
|
||||
if !ok {
|
||||
ttl = d.config.ServiceTTL["*"]
|
||||
}
|
||||
}
|
||||
|
||||
// Add various responses depending on the request
|
||||
qType := req.Question[0].Qtype
|
||||
if qType == dns.TypeSRV {
|
||||
|
|
Loading…
Reference in New Issue