Browse Source

close grpc connections during errors

pull/931/head
Chris Lu 6 years ago
parent
commit
e11e127d91
  1. 3
      weed/util/grpc_client_server.go

3
weed/util/grpc_client_server.go

@ -19,7 +19,7 @@ var (
grpcClientsLock sync.Mutex grpcClientsLock sync.Mutex
) )
func init(){
func init() {
http.DefaultTransport.(*http.Transport).MaxIdleConnsPerHost = 100 http.DefaultTransport.(*http.Transport).MaxIdleConnsPerHost = 100
} }
@ -81,6 +81,7 @@ func WithCachedGrpcClient(ctx context.Context, fn func(*grpc.ClientConn) error,
grpcClientsLock.Lock() grpcClientsLock.Lock()
delete(grpcClients, address) delete(grpcClients, address)
grpcClientsLock.Unlock() grpcClientsLock.Unlock()
grpcConnection.Close()
} }
return err return err

Loading…
Cancel
Save