mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-22 16:48:30 +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() {
|
go func() {
|
||||||
n := 1
|
n := 1
|
||||||
|
|
||||||
|
loop:
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-cancel:
|
case <-cancel:
|
||||||
break
|
break loop
|
||||||
default:
|
default:
|
||||||
conn, err := net.DialTimeout("tcp", addr, time.Duration(n)*time.Second)
|
conn, err := net.DialTimeout("tcp", addr, time.Duration(n)*time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -106,7 +108,7 @@ func TestTCPConn(addr string, timeout, interval int) error {
|
|||||||
log.Errorf("failed to close the connection: %v", err)
|
log.Errorf("failed to close the connection: %v", err)
|
||||||
}
|
}
|
||||||
success <- 1
|
success <- 1
|
||||||
break
|
break loop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Loading…
Reference in New Issue
Block a user