From a70503c7406c43c8bd8c1f4f6d14ac9db6ada1f2 Mon Sep 17 00:00:00 2001 From: marcelosousa <601882+marcelosousa@users.noreply.github.com> Date: Mon, 22 Aug 2022 09:46:56 +0100 Subject: [PATCH] fix: do not close grpc connection --- go/clients/semantic.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/go/clients/semantic.go b/go/clients/semantic.go index 1aa4789..3a5a676 100644 --- a/go/clients/semantic.go +++ b/go/clients/semantic.go @@ -10,17 +10,16 @@ import ( "google.golang.org/grpc/credentials/insecure" ) -func NewSemanticClient(endpoint string) (services.SemanticClient, error) { +func NewSemanticClient(endpoint string) (services.SemanticClient, *grpc.ClientConn, error) { defaultOptions := grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(419430400)) transportCredentials := grpc.WithTransportCredentials(insecure.NewCredentials()) semanticConnection, err := grpc.Dial(endpoint, transportCredentials, defaultOptions) if err != nil { - return nil, err + return nil, nil, err } - defer semanticConnection.Close() semanticClient := services.NewSemanticClient(semanticConnection) - return semanticClient, nil + return semanticClient, semanticConnection, nil }