Skip to content

Commit 1d2e9d8

Browse files
yuuahpCopilot
andauthored
fix: use select for checking channel
Co-authored-by: Copilot <[email protected]>
1 parent a56e347 commit 1d2e9d8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

main.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,10 @@ func main() {
157157
group.Wait() // wait for the primary server to respond
158158

159159
for _, address := range fallbacks {
160-
if len(channel) != 0 { // if the last server has already responded
160+
select {
161+
case <-channel: // if the last server has already responded
161162
break
163+
default:
162164
}
163165

164166
if result := CallNTP(address, quiet); result != nil {

0 commit comments

Comments
 (0)