Feature: updater: no sleep for last DNS resolution

This commit is contained in:
Quentin McGaw
2021-02-12 21:27:26 +00:00
parent fe5ec205fc
commit adaad62fbd

View File

@@ -86,7 +86,8 @@ func resolveRepeat(ctx context.Context, lookupIP lookupIPFunc, host string,
repetition int, timeBetween time.Duration) (ips []net.IP, err error) {
uniqueIPs := make(map[string]struct{})
for i := 0; i < repetition; i++ {
i := 0
for {
newIPs, err := lookupIP(ctx, host)
if err != nil {
return nil, err
@@ -95,6 +96,12 @@ func resolveRepeat(ctx context.Context, lookupIP lookupIPFunc, host string,
key := ip.String()
uniqueIPs[key] = struct{}{}
}
i++
if i == repetition {
break
}
timer := time.NewTimer(timeBetween)
select {
case <-timer.C: