[plugin/cache] cache failures (#2720)
* cache failures * use ServerError
This commit is contained in:
parent
58c703f5ef
commit
be8b29cd4d
3 changed files with 46 additions and 8 deletions
5
plugin/cache/cache.go
vendored
5
plugin/cache/cache.go
vendored
|
@ -163,6 +163,9 @@ func (w *ResponseWriter) WriteMsg(res *dns.Msg) error {
|
|||
var duration time.Duration
|
||||
if mt == response.NameError || mt == response.NoData {
|
||||
duration = computeTTL(msgTTL, w.minnttl, w.nttl)
|
||||
} else if mt == response.ServerError {
|
||||
// use default ttl which is 5s
|
||||
duration = minTTL
|
||||
} else {
|
||||
duration = computeTTL(msgTTL, w.minpttl, w.pttl)
|
||||
}
|
||||
|
@ -206,7 +209,7 @@ func (w *ResponseWriter) set(m *dns.Msg, key uint64, mt response.Type, duration
|
|||
i := newItem(m, w.now(), duration)
|
||||
w.pcache.Add(key, i)
|
||||
|
||||
case response.NameError, response.NoData:
|
||||
case response.NameError, response.NoData, response.ServerError:
|
||||
i := newItem(m, w.now(), duration)
|
||||
w.ncache.Add(key, i)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue