Add linters and fix lint issues
This commit is contained in:
@@ -6,16 +6,23 @@ import (
|
||||
)
|
||||
|
||||
func (c *configurator) WaitForUnbound() (err error) {
|
||||
const maxTries = 10
|
||||
const hostToResolve = "github.com"
|
||||
time.Sleep(300 * time.Millisecond)
|
||||
for try := 1; try <= maxTries; try++ {
|
||||
waitDurations := [...]time.Duration{
|
||||
300 * time.Millisecond,
|
||||
100 * time.Millisecond,
|
||||
300 * time.Millisecond,
|
||||
500 * time.Millisecond,
|
||||
time.Second,
|
||||
2 * time.Second,
|
||||
}
|
||||
maxTries := len(waitDurations)
|
||||
for i, waitDuration := range waitDurations {
|
||||
time.Sleep(waitDuration)
|
||||
_, err := c.lookupIP(hostToResolve)
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
c.logger.Warn("could not resolve %s (try %d of %d): %s", hostToResolve, try, maxTries, err)
|
||||
time.Sleep(maxTries * 50 * time.Millisecond)
|
||||
c.logger.Warn("could not resolve %s (try %d of %d): %s", hostToResolve, i+1, maxTries, err)
|
||||
}
|
||||
return fmt.Errorf("Unbound does not seem to be working after %d tries", maxTries)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user