-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: when local dns error occurs try every dns #1063
Conversation
util/wait_internet.go
Outdated
if isDNSErr(err) || errTimes > 0 { | ||
dns := BackupDNS[errTimes%len(BackupDNS)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if isDNSErr(err) || errTimes > 0 { | |
dns := BackupDNS[errTimes%len(BackupDNS)] | |
if isDNSErr(err) && len(BackupDNS) > 0 { | |
dns := BackupDNS[0] | |
BackupDNS = BackupDNS[1:] |
这样用完一个删一个是不是更好些?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有没有可能删除最后,也不通。也许在下一次循环就通了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有没有可能删除最后,也不通。也许在下一次循环就通了
// Rotate the backup DNS for reuse.
dns := BackupDNS[0]
BackupDNS = append(BackupDNS[1:], dns)
不删除了,轮换吧。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
最好不去改BackupDNS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那就没什么需要改的了,把 errTimes
这个命名改的更贴近用例就行了。因为并不是所有错误都会 ++,retryTimes
怎么样?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以
What does this PR do?
when local dns error occurs try every dns
Motivation
Additional Notes
improve #1057