mirror of https://github.com/grpc/grpc-node.git
Merge pull request #2536 from murgatroid99/grpc-js_pick_cancel_race
grpc-js: Handle race between call cancellation and auth metadata generation
This commit is contained in:
commit
9ef4655b3a
|
@ -140,6 +140,13 @@ export class LoadBalancingCall implements Call {
|
|||
.generateMetadata({ service_url: this.serviceUrl })
|
||||
.then(
|
||||
credsMetadata => {
|
||||
/* If this call was cancelled (e.g. by the deadline) before
|
||||
* metadata generation finished, we shouldn't do anything with
|
||||
* it. */
|
||||
if (this.ended) {
|
||||
this.trace('Credentials metadata generation finished after call ended');
|
||||
return;
|
||||
}
|
||||
const finalMetadata = this.metadata!.clone();
|
||||
finalMetadata.merge(credsMetadata);
|
||||
if (finalMetadata.get('authorization').length > 1) {
|
||||
|
|
Loading…
Reference in New Issue