Merge remote-tracking branch 'upstream/@grpc/grpc-js@1.8.x' into v1.8.x_upmerge_3

This commit is contained in:
Michael Lumish 2023-07-25 10:10:16 -07:00
commit e83ce3b6fd
2 changed files with 14 additions and 15 deletions

View File

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

View File

@ -153,6 +153,14 @@ class Http2Transport implements Transport {
*/
private remoteName: string | null
) {
/* Populate subchannelAddressString and channelzRef before doing anything
* else, because they are used in the trace methods. */
this.subchannelAddressString = subchannelAddressToString(subchannelAddress);
if (options['grpc.enable_channelz'] === 0) {
this.channelzEnabled = false;
}
this.channelzRef = registerChannelzSocket(this.subchannelAddressString, () => this.getChannelzInfo(), this.channelzEnabled);
// Build user-agent string.
this.userAgent = [
options['grpc.primary_user_agent'],
@ -174,20 +182,6 @@ class Http2Transport implements Transport {
} else {
this.keepaliveWithoutCalls = false;
}
if (this.keepaliveWithoutCalls) {
this.maybeStartKeepalivePingTimer();
}
this.subchannelAddressString = subchannelAddressToString(subchannelAddress);
if (options['grpc.enable_channelz'] === 0) {
this.channelzEnabled = false;
}
this.channelzRef = registerChannelzSocket(
this.subchannelAddressString,
() => this.getChannelzInfo(),
this.channelzEnabled
);
session.once('close', () => {
this.trace('session closed');
@ -233,6 +227,11 @@ class Http2Transport implements Transport {
);
});
}
/* Start the keepalive timer last, because this can trigger trace logs,
* which should only happen after everything else is set up. */
if (this.keepaliveWithoutCalls) {
this.maybeStartKeepalivePingTimer();
}
}
private getChannelzInfo(): SocketInfo {