aboutsummaryrefslogtreecommitdiff
path: root/plugin/cache/handler.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2017-09-20 11:36:41 +0100
committerGravatar GitHub <noreply@github.com> 2017-09-20 11:36:41 +0100
commitcd5879f866641141a241706d0d0a0219e52b7e68 (patch)
treee88a040834128512a4682aebae5aeafa456588f1 /plugin/cache/handler.go
parentbe4770927048627b59a6ce80587d668d7c028518 (diff)
downloadcoredns-cd5879f866641141a241706d0d0a0219e52b7e68.tar.gz
coredns-cd5879f866641141a241706d0d0a0219e52b7e68.tar.zst
coredns-cd5879f866641141a241706d0d0a0219e52b7e68.zip
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
Diffstat (limited to 'plugin/cache/handler.go')
-rw-r--r--plugin/cache/handler.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/plugin/cache/handler.go b/plugin/cache/handler.go
index ebd87d659..f3f2e675b 100644
--- a/plugin/cache/handler.go
+++ b/plugin/cache/handler.go
@@ -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?