From 60bc11285b5da059e641eb9e5b957b9be305014e Mon Sep 17 00:00:00 2001 From: Michael Lumish Date: Fri, 28 Aug 2020 10:43:16 -0700 Subject: [PATCH] Send buffered stats when starting LRS stream --- packages/grpc-js/src/xds-client.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/grpc-js/src/xds-client.ts b/packages/grpc-js/src/xds-client.ts index 62f14f61..39c01646 100644 --- a/packages/grpc-js/src/xds-client.ts +++ b/packages/grpc-js/src/xds-client.ts @@ -1029,7 +1029,6 @@ export class XdsClient { message.load_reporting_interval!.nanos / 1_000_000; trace('Received LRS request with load reporting interval ' + loadReportingIntervalMs + ' ms'); this.statsTimer = setInterval(() => { - trace('Sending LRS stats'); this.sendStats(); }, loadReportingIntervalMs); } @@ -1047,15 +1046,16 @@ export class XdsClient { this.maybeStartLrsStream(); } }); - this.lrsCall.write({ - node: this.lrsNode!, - }); + /* Send buffered stats information when starting LRS stream. If there is no + * buffered stats information, it will still send the node field. */ + this.sendStats(); } private sendStats() { if (!this.lrsCall) { return; } + trace('Sending LRS stats'); const clusterStats: ClusterStats[] = []; for (const [ { clusterName, edsServiceName },