Switch resolver pooling to use sync.Pool

This commit is contained in:
Daniel 2020-05-20 14:57:47 +02:00
parent 36c60a1e33
commit c8223f1a63
4 changed files with 41 additions and 81 deletions

View file

@ -14,8 +14,6 @@ import (
)
var (
mtAsyncResolve = "async resolve"
// basic errors
// ErrNotFound is a basic error that will match all "not found" errors
@ -160,7 +158,7 @@ func checkCache(ctx context.Context, q *Query) *RRCache {
log.Tracer(ctx).Trace("resolver: serving from cache, requesting new")
// resolve async
module.StartLowPriorityMicroTask(&mtAsyncResolve, func(ctx context.Context) error {
module.StartWorker("resolve async", func(ctx context.Context) error {
_, _ = resolveAndCache(ctx, q)
return nil
})
@ -220,11 +218,6 @@ func resolveAndCache(ctx context.Context, q *Query) (rrCache *RRCache, err error
return nil, ErrNoCompliance
}
// prep
lastFailBoundary := time.Now().Add(
-time.Duration(nameserverRetryRate()) * time.Second,
)
// start resolving
var i int