plugin/cache: fix benchmark (#1758)

This commit is contained in:
Miek Gieben 2018-04-30 20:25:40 +01:00 committed by GitHub
parent c0590e4ec4
commit a8fce24d46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -231,15 +231,15 @@ func BenchmarkCacheResponse(b *testing.B) {
reqs[i].SetQuestion(q+".example.org.", dns.TypeA)
}
b.RunParallel(func(pb *testing.PB) {
i := 0
for pb.Next() {
req := reqs[i]
b.StartTimer()
j := 0
for i := 0; i < b.N; i++ {
req := reqs[j]
c.ServeDNS(ctx, &test.ResponseWriter{}, req)
i++
i = i % 5
j++
j = j % 5
}
})
}
func BackendHandler() plugin.Handler {