Skip to content

Commit

Permalink
fix: add context timeout to health check
Browse files Browse the repository at this point in the history
Signed-off-by: Gaius <[email protected]>
  • Loading branch information
gaius-qi committed Dec 15, 2023
1 parent 1303d77 commit cf5637f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/rpc/health/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func Check(ctx context.Context, target string, opts ...grpc.DialOption) error {
}
defer healthClient.Close()

if err := healthClient.Check(context.Background(), &healthpb.HealthCheckRequest{}); err != nil {
if err := healthClient.Check(ctx, &healthpb.HealthCheckRequest{}); err != nil {
return err
}

Expand Down Expand Up @@ -115,3 +115,8 @@ func (c *client) Check(ctx context.Context, req *healthpb.HealthCheckRequest, op

return nil
}

// Close tears down the ClientConn and all underlying connections.
func (c *client) Close() error {
return c.ClientConn.Close()
}

0 comments on commit cf5637f

Please sign in to comment.