Merge pull request #1197 from murgatroid99/grpc-js_handle_goaway_race

grpc-js: Handle error when starting call on subchannel
This commit is contained in:
Michael Lumish 2019-12-02 11:02:30 -08:00 committed by GitHub
commit cb0792818c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@grpc/grpc-js", "name": "@grpc/grpc-js",
"version": "0.6.12", "version": "0.6.13",
"description": "gRPC Library for Node - pure JS implementation", "description": "gRPC Library for Node - pure JS implementation",
"homepage": "https://grpc.io/", "homepage": "https://grpc.io/",
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js", "repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",

View File

@ -216,10 +216,17 @@ export class ChannelImplementation implements Channel {
pickResult.subchannel!.getConnectivityState() === pickResult.subchannel!.getConnectivityState() ===
ConnectivityState.READY ConnectivityState.READY
) { ) {
try {
pickResult.subchannel!.startCallStream( pickResult.subchannel!.startCallStream(
finalMetadata, finalMetadata,
callStream callStream
); );
} catch (error) {
callStream.cancelWithStatus(
Status.UNAVAILABLE,
'Failed to start call on picked subchannel'
);
}
} else { } else {
callStream.cancelWithStatus( callStream.cancelWithStatus(
Status.UNAVAILABLE, Status.UNAVAILABLE,