|
|
@ -137,21 +137,21 @@ func RegisterSubscriptionServiceHandlerServer(ctx context.Context, mux *runtime.
|
|
|
|
// RegisterSubscriptionServiceHandlerFromEndpoint is same as RegisterSubscriptionServiceHandler but
|
|
|
|
// RegisterSubscriptionServiceHandlerFromEndpoint is same as RegisterSubscriptionServiceHandler but
|
|
|
|
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
|
|
|
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
|
|
|
func RegisterSubscriptionServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
|
|
|
func RegisterSubscriptionServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
|
|
|
conn, err := grpc.DialContext(ctx, endpoint, opts...)
|
|
|
|
conn, err := grpc.NewClient(endpoint, opts...)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
defer func() {
|
|
|
|
defer func() {
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
if cerr := conn.Close(); cerr != nil {
|
|
|
|
if cerr := conn.Close(); cerr != nil {
|
|
|
|
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
|
|
|
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
go func() {
|
|
|
|
go func() {
|
|
|
|
<-ctx.Done()
|
|
|
|
<-ctx.Done()
|
|
|
|
if cerr := conn.Close(); cerr != nil {
|
|
|
|
if cerr := conn.Close(); cerr != nil {
|
|
|
|
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
|
|
|
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
}()
|
|
|
|
}()
|
|
|
|
}()
|
|
|
|