healthCheck will check if the client is still healthy, returning an error if it is not
(client PoolClient, timeout time.Duration)
| 190 | |
| 191 | // healthCheck will check if the client is still healthy, returning an error if it is not |
| 192 | func healthCheck(client PoolClient, timeout time.Duration) error { |
| 193 | ctx, cancel := context.WithTimeout(context.Background(), timeout) |
| 194 | defer cancel() |
| 195 | ctx = user.InjectOrgID(ctx, "0") |
| 196 | |
| 197 | resp, err := client.Check(ctx, &grpc_health_v1.HealthCheckRequest{}) |
| 198 | if err != nil { |
| 199 | return err |
| 200 | } |
| 201 | if resp.Status != grpc_health_v1.HealthCheckResponse_SERVING { |
| 202 | return fmt.Errorf("failing healthcheck status: %s", resp.Status) |
| 203 | } |
| 204 | return nil |
| 205 | } |