Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2023-09-06 12:58:05 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2023-09-07 09:34:27 +0300
commit154617c26466a8e14ed14beb149a0e80f752878b (patch)
treee28e9796926732cbbb18c401108bd49f82bfa168 /client
parentc50cf9a578f6abd5a7e85a445bd560ec59ab8d51 (diff)
client: Move `HealthCheckDialer` logic into internal package
Move the `HealthCheckDialer` logic into our internal client package. Like this we can reuse the functionality internally without having to rely on our public interface, which allows us to iterate on its internal implementation without breaking the public API.
Diffstat (limited to 'client')
-rw-r--r--client/dial.go15
1 files changed, 1 insertions, 14 deletions
diff --git a/client/dial.go b/client/dial.go
index 2f0a279e6..e552e6f6a 100644
--- a/client/dial.go
+++ b/client/dial.go
@@ -12,7 +12,6 @@ import (
"gitlab.com/gitlab-org/gitaly/v16/internal/grpc/dnsresolver"
"gitlab.com/gitlab-org/gitaly/v16/internal/grpc/sidechannel"
"google.golang.org/grpc"
- healthpb "google.golang.org/grpc/health/grpc_health_v1"
)
// DefaultDialOpts hold the default DialOptions for connection to Gitaly over UNIX-socket
@@ -56,19 +55,7 @@ func FailOnNonTempDialError() []grpc.DialOption {
// HealthCheckDialer uses provided dialer as an actual dialer, but issues a health check request to the remote
// to verify the connection was set properly and could be used with no issues.
func HealthCheckDialer(base Dialer) Dialer {
- return func(ctx context.Context, address string, dialOptions []grpc.DialOption) (*grpc.ClientConn, error) {
- cc, err := base(ctx, address, dialOptions)
- if err != nil {
- return nil, err
- }
-
- if _, err := healthpb.NewHealthClient(cc).Check(ctx, &healthpb.HealthCheckRequest{}); err != nil {
- _ = cc.Close()
- return nil, err
- }
-
- return cc, nil
- }
+ return Dialer(client.HealthCheckDialer(client.Dialer(base)))
}
// DNSResolverBuilderConfig exposes the DNS resolver builder option. It is used to build Gitaly