plugin/cache: cap TTL on first answer (#1092)
Cache would let the first response through and would then cap subsequent ones to whatever the cache duration was. This would lead to huge drops in TTL values: 3600 -> 20 for instance, which is not only bad, but can mess up your careful TTL planning business. This PR fixes that and applies the cache duration to all replies. As a bonus I could remove a time.Sleep() from the cache test and just check for the cache duration as the TTL on the reply. Fixes #1038
This commit is contained in:
parent
be47709270
commit
cd5879f866
3 changed files with 17 additions and 23 deletions
2
plugin/cache/handler.go
vendored
2
plugin/cache/handler.go
vendored
|
@ -19,7 +19,7 @@ func (c *Cache) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
|
|||
qtype := state.QType()
|
||||
zone := plugin.Zones(c.Zones).Matches(qname)
|
||||
if zone == "" {
|
||||
return c.Next.ServeDNS(ctx, w, r)
|
||||
return plugin.NextOrFailure(c.Name(), c.Next, ctx, w, r)
|
||||
}
|
||||
|
||||
do := state.Do() // TODO(): might need more from OPT record? Like the actual bufsize?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue