cmd/ctrld: do not retry failed query

Most the client will retry failed request itself. Doing this on the
server give no benefit, and could cause un-necessary load when the
server is busy.
This commit is contained in:
Cuong Manh Le
2023-06-16 20:04:54 +07:00
committed by Cuong Manh Le
parent 48b2031269
commit c315d21be9

View File

@@ -244,15 +244,7 @@ func (p *prog) proxy(ctx context.Context, upstreams []string, failoverRcodes []i
}
}
answer, err := resolve1(n, upstreamConfig, msg)
// Only do re-bootstrapping if bootstrap ip is not explicitly set by user.
if err != nil && upstreamConfig.BootstrapIP == "" {
ctrld.Log(ctx, mainLog.Debug().Err(err), "could not resolve query on first attempt, retrying...")
// If any error occurred, re-bootstrap transport/ip, retry the request.
upstreamConfig.ReBootstrap()
answer, err = resolve1(n, upstreamConfig, msg)
if err == nil {
return answer
}
if err != nil {
ctrld.Log(ctx, mainLog.Error().Err(err), "failed to resolve query")
return nil
}