@@ -35,6 +35,7 @@ import (
3535 "github.com/opentracing/opentracing-go"
3636 "github.com/pborman/uuid"
3737 "github.com/uber-go/tally"
38+ "go.uber.org/zap"
3839
3940 commonpb "go.temporal.io/temporal-proto/common"
4041 eventpb "go.temporal.io/temporal-proto/event"
7071 connectionCloser io.Closer
7172 namespace string
7273 registry * registry
74+ logger * zap.Logger
7375 metricsScope * metrics.TaggedScope
7476 identity string
7577 dataConverter DataConverter
8284 workflowService workflowservice.WorkflowServiceClient
8385 connectionCloser io.Closer
8486 metricsScope tally.Scope
87+ logger * zap.Logger
8588 identity string
8689 }
8790
@@ -942,12 +945,13 @@ func (wc *WorkflowClient) DescribeTaskList(ctx context.Context, taskList string,
942945}
943946
944947// CloseConnection closes underlying gRPC connection.
945- func (wc * WorkflowClient ) CloseConnection () error {
948+ func (wc * WorkflowClient ) CloseConnection () {
946949 if wc .connectionCloser == nil {
947- return nil
950+ return
951+ }
952+ if err := wc .connectionCloser .Close (); err != nil {
953+ wc .logger .Warn ("unable to close connection" , zap .Error (err ))
948954 }
949-
950- return wc .connectionCloser .Close ()
951955}
952956
953957func (wc * WorkflowClient ) getWorkflowHeader (ctx context.Context ) * commonpb.Header {
@@ -966,13 +970,13 @@ func (wc *WorkflowClient) getWorkflowHeader(ctx context.Context) *commonpb.Heade
966970// - NamespaceAlreadyExistsError
967971// - BadRequestError
968972// - InternalServiceError
969- func (dc * namespaceClient ) Register (ctx context.Context , request * workflowservice.RegisterNamespaceRequest ) error {
973+ func (nc * namespaceClient ) Register (ctx context.Context , request * workflowservice.RegisterNamespaceRequest ) error {
970974 return backoff .Retry (ctx ,
971975 func () error {
972976 tchCtx , cancel := newChannelContext (ctx )
973977 defer cancel ()
974978 var err error
975- _ , err = dc .workflowService .RegisterNamespace (tchCtx , request )
979+ _ , err = nc .workflowService .RegisterNamespace (tchCtx , request )
976980 return err
977981 }, createDynamicServiceRetryPolicy (ctx ), isServiceTransientError )
978982}
@@ -985,7 +989,7 @@ func (dc *namespaceClient) Register(ctx context.Context, request *workflowservic
985989// - EntityNotExistsError
986990// - BadRequestError
987991// - InternalServiceError
988- func (dc * namespaceClient ) Describe (ctx context.Context , name string ) (* workflowservice.DescribeNamespaceResponse , error ) {
992+ func (nc * namespaceClient ) Describe (ctx context.Context , name string ) (* workflowservice.DescribeNamespaceResponse , error ) {
989993 request := & workflowservice.DescribeNamespaceRequest {
990994 Name : name ,
991995 }
@@ -996,7 +1000,7 @@ func (dc *namespaceClient) Describe(ctx context.Context, name string) (*workflow
9961000 tchCtx , cancel := newChannelContext (ctx )
9971001 defer cancel ()
9981002 var err error
999- response , err = dc .workflowService .DescribeNamespace (tchCtx , request )
1003+ response , err = nc .workflowService .DescribeNamespace (tchCtx , request )
10001004 return err
10011005 }, createDynamicServiceRetryPolicy (ctx ), isServiceTransientError )
10021006 if err != nil {
@@ -1010,23 +1014,24 @@ func (dc *namespaceClient) Describe(ctx context.Context, name string) (*workflow
10101014// - EntityNotExistsError
10111015// - BadRequestError
10121016// - InternalServiceError
1013- func (dc * namespaceClient ) Update (ctx context.Context , request * workflowservice.UpdateNamespaceRequest ) error {
1017+ func (nc * namespaceClient ) Update (ctx context.Context , request * workflowservice.UpdateNamespaceRequest ) error {
10141018 return backoff .Retry (ctx ,
10151019 func () error {
10161020 tchCtx , cancel := newChannelContext (ctx )
10171021 defer cancel ()
1018- _ , err := dc .workflowService .UpdateNamespace (tchCtx , request )
1022+ _ , err := nc .workflowService .UpdateNamespace (tchCtx , request )
10191023 return err
10201024 }, createDynamicServiceRetryPolicy (ctx ), isServiceTransientError )
10211025}
10221026
10231027// CloseConnection closes underlying gRPC connection.
1024- func (dc * namespaceClient ) CloseConnection () error {
1025- if dc .connectionCloser == nil {
1026- return nil
1028+ func (nc * namespaceClient ) CloseConnection () {
1029+ if nc .connectionCloser == nil {
1030+ return
1031+ }
1032+ if err := nc .connectionCloser .Close (); err != nil {
1033+ nc .logger .Warn ("unable to close connection" , zap .Error (err ))
10271034 }
1028-
1029- return dc .connectionCloser .Close ()
10301035}
10311036
10321037func (iter * historyEventIteratorImpl ) HasNext () bool {
0 commit comments