Feature: updater: no sleep for last DNS resolution
This commit is contained in:
@@ -86,7 +86,8 @@ func resolveRepeat(ctx context.Context, lookupIP lookupIPFunc, host string,
|
|||||||
repetition int, timeBetween time.Duration) (ips []net.IP, err error) {
|
repetition int, timeBetween time.Duration) (ips []net.IP, err error) {
|
||||||
uniqueIPs := make(map[string]struct{})
|
uniqueIPs := make(map[string]struct{})
|
||||||
|
|
||||||
for i := 0; i < repetition; i++ {
|
i := 0
|
||||||
|
for {
|
||||||
newIPs, err := lookupIP(ctx, host)
|
newIPs, err := lookupIP(ctx, host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -95,6 +96,12 @@ func resolveRepeat(ctx context.Context, lookupIP lookupIPFunc, host string,
|
|||||||
key := ip.String()
|
key := ip.String()
|
||||||
uniqueIPs[key] = struct{}{}
|
uniqueIPs[key] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i++
|
||||||
|
if i == repetition {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
timer := time.NewTimer(timeBetween)
|
timer := time.NewTimer(timeBetween)
|
||||||
select {
|
select {
|
||||||
case <-timer.C:
|
case <-timer.C:
|
||||||
|
|||||||
Reference in New Issue
Block a user