Merge pull request #1286 from murgatroid99/grpc-js_auto_retry_code_check

grpc-js: Only automatically retry picks on known error
This commit is contained in:
Michael Lumish 2020-03-04 10:26:05 -08:00 committed by GitHub
commit 2c40be8884
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 32 additions and 19 deletions

View File

@ -265,6 +265,7 @@ export class ChannelImplementation implements Channel {
callStream callStream
); );
} catch (error) { } catch (error) {
if ((error as NodeJS.ErrnoException).code === 'ERR_HTTP2_GOAWAY_SESSION') {
/* An error here indicates that something went wrong with /* An error here indicates that something went wrong with
* the picked subchannel's http2 stream right before we * the picked subchannel's http2 stream right before we
* tried to start the stream. We are handling a promise * tried to start the stream. We are handling a promise
@ -288,6 +289,18 @@ export class ChannelImplementation implements Channel {
'. Retrying pick' '. Retrying pick'
); );
this.tryPick(callStream, callMetadata); this.tryPick(callStream, callMetadata);
} else {
trace(
LogVerbosity.INFO,
'channel',
'Failed to start call on picked subchanel ' +
pickResult.subchannel!.getAddress() +
' with error ' +
(error as Error).message +
'. Ending call'
);
callStream.cancelWithStatus(Status.INTERNAL, 'Failed to start HTTP/2 stream');
}
} }
} else { } else {
/* The logic for doing this here is the same as in the catch /* The logic for doing this here is the same as in the catch