From 0b075f18bb4c041f6c188313fea4215269e5ce61 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 20 Apr 2018 14:46:51 -0700 Subject: [PATCH] Add subchannel error handler, copy waitForReady wrapper from 1.11 --- packages/grpc-js-core/src/channel.ts | 1 + packages/grpc-js-core/src/index.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/packages/grpc-js-core/src/channel.ts b/packages/grpc-js-core/src/channel.ts index e710b733e..44dcfae74 100644 --- a/packages/grpc-js-core/src/channel.ts +++ b/packages/grpc-js-core/src/channel.ts @@ -191,6 +191,7 @@ export class Http2Channel extends EventEmitter implements Channel { ConnectivityState.TRANSIENT_FAILURE); }; subChannel.once('close', this.subChannelCloseCallback); + subChannel.once('error', this.subChannelCloseCallback); } constructor( diff --git a/packages/grpc-js-core/src/index.ts b/packages/grpc-js-core/src/index.ts index 5a3f60251..95328f9c7 100644 --- a/packages/grpc-js-core/src/index.ts +++ b/packages/grpc-js-core/src/index.ts @@ -85,3 +85,8 @@ export { * @param client The client to close. */ export const closeClient = (client: Client) => client.close(); + +export const waitForClientReady = + (client: Client, deadline: Date|number, + callback: (error: Error|null) => void) => + client.waitForReady(deadline, callback);