Skip to content

Commit

Permalink
Merge pull request #1273 from murgatroid99/grpc-js_pick_error_handling
Browse files Browse the repository at this point in the history
Clone metadata going into the metadata filter stack
  • Loading branch information
murgatroid99 authored Feb 24, 2020
2 parents 086fb3d + 18869dc commit 7a4c52b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/grpc-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@grpc/grpc-js",
"version": "0.6.17",
"version": "0.6.18",
"description": "gRPC Library for Node - pure JS implementation",
"homepage": "https://grpc.io/",
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",
Expand Down
7 changes: 6 additions & 1 deletion packages/grpc-js/src/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,11 @@ export class ChannelImplementation implements Channel {
this.pickQueue.push({ callStream, callMetadata });
break;
}
/* We need to clone the callMetadata here because the transparent
* retry code in the promise resolution handler use the same
* callMetadata object, so it needs to stay unmodified */
callStream.filterStack
.sendMetadata(Promise.resolve(callMetadata))
.sendMetadata(Promise.resolve(callMetadata.clone()))
.then(
finalMetadata => {
const subchannelState: ConnectivityState = pickResult.subchannel!.getConnectivityState();
Expand Down Expand Up @@ -280,6 +283,8 @@ export class ChannelImplementation implements Channel {
'channel',
'Failed to start call on picked subchannel ' +
pickResult.subchannel!.getAddress() +
' with error ' +
(error as Error).message +
'. Retrying pick'
);
this.tryPick(callStream, callMetadata);
Expand Down

0 comments on commit 7a4c52b

Please sign in to comment.