diff --git a/internal/pkg/grpc/client.go b/internal/pkg/grpc/client.go index 670a63b..db4f37f 100644 --- a/internal/pkg/grpc/client.go +++ b/internal/pkg/grpc/client.go @@ -16,6 +16,7 @@ package grpc import ( "bytes" + "errors" "fmt" "google.golang.org/grpc/credentials/insecure" "log" @@ -122,6 +123,11 @@ func (c *Client) SendRequest(serviceMethod string, message string, headers []str interpolatedHeaders[i] = placeholders.InterpolatePlaceholders(header) } + if c.conn == nil { + log.Printf("No connection available. Skip making request.") + return response.Response{Duration: time.Duration(0), Err: errors.New("no connection available"), Type: respType} + } + err = grpcurl.InvokeRPC(context.Background(), c.descriptorSource, c.conn, serviceMethod, interpolatedHeaders, loggingEventHandler, requestParser.Next) endTime := time.Now() if err != nil { diff --git a/internal/pkg/warmup/target.go b/internal/pkg/warmup/target.go index 9e8c138..4c80fcc 100644 --- a/internal/pkg/warmup/target.go +++ b/internal/pkg/warmup/target.go @@ -81,6 +81,7 @@ func (t Target) WaitForReadinessProbe(maxReadinessWaitDurationInSeconds int, hea connErr := t.readinessGrpcClient.Connect(nil) if connErr != nil { log.Printf("gRPC readiness client connect error: %v", connErr) + continue } err1 := t.readinessGrpcClient.SendRequest(request.ServiceMethod, "", headers, false) if err1.Err != nil {