middleware/cache: fix race (#757)

While adding a parallel performance benchmark I stumbled on a race
condition (another reason to add performance benchmarks!), so this
PR makes sure the msg is created in a race free manor and adds the
parallel benchmark.
This commit is contained in:
Miek Gieben 2017-06-26 07:44:25 -07:00 committed by GitHub
parent ea90702bfc
commit da5880a273
4 changed files with 67 additions and 27 deletions

View file

@ -113,7 +113,6 @@ func (w *ResponseWriter) WriteMsg(res *dns.Msg) error {
cacheSize.WithLabelValues(Denial).Set(float64(w.ncache.Len()))
}
setMsgTTL(res, uint32(duration.Seconds()))
if w.prefetch {
return nil
}