Skip to content
This repository was archived by the owner on Jan 16, 2023. It is now read-only.

Commit d7d2013

Browse files
committed
Merge pull request #72 in DEV/k8s-argus from DEV-65158-grpc-conn to develop
* commit 'db685c9a175b72381bf6ac6069e81c0c0d0002eb': DEV-65158: converted for kind of loop to do while
2 parents 3e0318b + db685c9 commit d7d2013

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/connection/connection.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func createGRPCConnection() (*grpc.ClientConn, error) {
7777
select {
7878
case <-timeout:
7979
return nil, fmt.Errorf("timeout waiting for gRPC connection")
80-
case <-ticker.C:
80+
default:
8181
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(10)*time.Second)
8282
defer cancel()
8383
conn, err := grpc.DialContext(ctx, appConfig.Address, grpc.WithBlock(), grpc.WithInsecure())
@@ -86,6 +86,7 @@ func createGRPCConnection() (*grpc.ClientConn, error) {
8686
} else {
8787
return conn, nil
8888
}
89+
<-ticker.C
8990
}
9091
}
9192
}
@@ -101,12 +102,13 @@ func createCSCClient() (api.CollectorSetControllerClient, error) {
101102
select {
102103
case <-timeout:
103104
return client, fmt.Errorf("timeout waiting for collectors to become available")
104-
case <-ticker.C:
105+
default:
105106
healthCheckResponse := getCSCHealth(hc)
106107
if healthCheckResponse.GetStatus() == healthpb.HealthCheckResponse_SERVING {
107108
return client, nil
108109
}
109110
log.Debugf("The collectors are not ready: %v", healthCheckResponse.GetStatus().String())
111+
<-ticker.C
110112
}
111113
}
112114
}

0 commit comments

Comments
 (0)