From 23982897830fd29944ad702b751e72217601ee9a Mon Sep 17 00:00:00 2001 From: Homayoon Alimohammadi Date: Fri, 5 Apr 2024 20:00:41 +0330 Subject: [PATCH] Fix comments --- internal/resolver/dns/dns_resolver.go | 16 ++++++++-------- internal/resolver/dns/dns_resolver_test.go | 4 ++-- resolver/dns/dns_resolver.go | 3 --- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/internal/resolver/dns/dns_resolver.go b/internal/resolver/dns/dns_resolver.go index c06ff7f40d83..7a9080ff8d4d 100644 --- a/internal/resolver/dns/dns_resolver.go +++ b/internal/resolver/dns/dns_resolver.go @@ -49,16 +49,16 @@ var ( // MinResolutionRate is the minimum rate at which re-resolutions are // allowed. This helps to prevent excessive re-resolution. MinResolutionRate = 30 * time.Second -) -// ResolvingTimeout specifies the maximum duration for a DNS resolution request. -// If the timeout expires before a response is received, the request will be canceled. -// -// It is recommended to set this value at application startup. Avoid modifying this variable -// after initialization as it's not thread-safe for concurrent modification. -var ResolvingTimeout = 30 * time.Second + // ResolvingTimeout specifies the maximum duration for a DNS resolution request. + // If the timeout expires before a response is received, the request will be canceled. + // + // It is recommended to set this value at application startup. Avoid modifying this variable + // after initialization as it's not thread-safe for concurrent modification. + ResolvingTimeout = 30 * time.Second -var logger = grpclog.Component("dns") + logger = grpclog.Component("dns") +) func init() { resolver.Register(NewBuilder()) diff --git a/internal/resolver/dns/dns_resolver_test.go b/internal/resolver/dns/dns_resolver_test.go index a431e38f2b03..616b5731acda 100644 --- a/internal/resolver/dns/dns_resolver_test.go +++ b/internal/resolver/dns/dns_resolver_test.go @@ -71,8 +71,8 @@ func overrideNetResolver(t *testing.T, r *testNetResolver) { // Override the DNS Min Res Rate used by the resolver. func overrideResolutionRate(t *testing.T, d time.Duration) { origMinResRate := dns.MinResolutionRate - dns.MinResolutionRate = d - t.Cleanup(func() { dns.MinResolutionRate = origMinResRate }) + dnspublic.SetMinResolutionRate(d) + t.Cleanup(func() { dnspublic.SetMinResolutionRate(origMinResRate) }) } // Override the timer used by the DNS resolver to fire after a duration of d. diff --git a/resolver/dns/dns_resolver.go b/resolver/dns/dns_resolver.go index 756c0ee0fcf3..f1b436d2f639 100644 --- a/resolver/dns/dns_resolver.go +++ b/resolver/dns/dns_resolver.go @@ -55,9 +55,6 @@ func NewBuilder() resolver.Builder { // SetMinResolutionRate sets the default minimum rate at which DNS re-resolutions are // allowed. This helps to prevent excessive re-resolution. -// -// Using this option overwrites the default [MinResolutionRate] specified -// in the internal dns resolver package. func SetMinResolutionRate(d time.Duration) { dns.MinResolutionRate = d }