mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-22 00:27:44 +01:00
Merge pull request #5840 from Colstuwjx/fix-tcp-probe
Fix `TestTCPConn` break issue.
This commit is contained in:
commit
1f195c2b5f
@ -89,10 +89,12 @@ func TestTCPConn(addr string, timeout, interval int) error {
|
||||
|
||||
go func() {
|
||||
n := 1
|
||||
|
||||
loop:
|
||||
for {
|
||||
select {
|
||||
case <-cancel:
|
||||
break
|
||||
break loop
|
||||
default:
|
||||
conn, err := net.DialTimeout("tcp", addr, time.Duration(n)*time.Second)
|
||||
if err != nil {
|
||||
@ -106,7 +108,7 @@ func TestTCPConn(addr string, timeout, interval int) error {
|
||||
log.Errorf("failed to close the connection: %v", err)
|
||||
}
|
||||
success <- 1
|
||||
break
|
||||
break loop
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
Loading…
Reference in New Issue
Block a user