Skip to content

Commit

Permalink
Fixing typos and logging
Browse files Browse the repository at this point in the history
  • Loading branch information
hurricanehrndz committed Aug 16, 2024
1 parent 7b40359 commit 365f6b7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions client/internal/dns/upstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ func (u *upstreamResolverBase) watchPeersConnStatusChanges() {

u.probeAvailability()
if u.disabled {
return fmt.Errorf("probe faled")
return fmt.Errorf("probe failed")
}
return nil
}

continualProbe := func() {
// probe continually for 30s when peer count >= 1
if u.statusRecorder.GetConnectedPeersCount() == 0 {
log.Debug("O peer connected, running one more DNS probe")
log.Debug("O peers connected, running one more DNS probe")
// cancel backoff operation
if cancelBackOff != nil {
cancelBackOff()
Expand All @@ -111,13 +111,13 @@ func (u *upstreamResolverBase) watchPeersConnStatusChanges() {
}

if probeRunning.Load() {
log.Info("restarting DNS probing")
log.Info("restart DNS probing")
cancelBackOff()
cancelBackOff = nil
}
defer func() {
u.mutex.Lock()
log.Infof("DNS probing finished, servers %s disabled: %t", u.upstreamServers, u.disabled)
log.Infof("DNS probe finished, servers %s disabled: %t", u.upstreamServers, u.disabled)
u.mutex.Unlock()
probeRunning.Store(false)
}()
Expand All @@ -128,15 +128,14 @@ func (u *upstreamResolverBase) watchPeersConnStatusChanges() {
err := backoff.Retry(func() error {
select {
case <-ctx.Done():
log.Warn("DNS probing cancelled")
return backoff.Permanent(ctx.Err())
default:
return operation()
}
}, backoff.WithContext(exponentialBackOff, ctx))
cancelBackOff = nil
if err != nil {
log.Warn("DNS probe trigger by peer connection failed")
log.Warnf("DNS probe trigger by peer connection stopped: %s", err)
u.disable(err)
return
}
Expand Down Expand Up @@ -317,7 +316,8 @@ func (u *upstreamResolverBase) waitUntilResponse() {
err := backoff.Retry(func() error {
u.probeAvailability()
if u.disabled {
return fmt.Errorf("failed to enable upsstream")
log.Tracef("checking connectivity with upstreams %s failed. Retrying in %s", u.upstreamServers, exponentialBackOff.NextBackOff())
return fmt.Errorf("upstream check call error")
}
return nil
}, exponentialBackOff)
Expand Down

0 comments on commit 365f6b7

Please sign in to comment.