From 198ff4e9ea821211917dcc7535f3f37fa5996251 Mon Sep 17 00:00:00 2001 From: Michael Lumish Date: Tue, 14 Jan 2025 13:35:36 -0800 Subject: [PATCH] grpc-js-xds: Start resource timers for resources requested after stream start --- packages/grpc-js-xds/src/xds-client.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/grpc-js-xds/src/xds-client.ts b/packages/grpc-js-xds/src/xds-client.ts index 2b4f27fb9..1ebeccc38 100644 --- a/packages/grpc-js-xds/src/xds-client.ts +++ b/packages/grpc-js-xds/src/xds-client.ts @@ -296,6 +296,7 @@ class AdsCallState { public typeStates: Map = new Map(); private receivedAnyResponse = false; private sentInitialMessage = false; + private streamStarted = false; constructor(public client: XdsSingleServerClient, private call: AdsCall, private node: Node) { // Populate subscription map with existing subscriptions for (const [authority, authorityState] of client.xdsClient.authorityStateMap) { @@ -438,6 +439,9 @@ class AdsCallState { } if (!authorityMap.has(name.key)) { const timer = new ResourceTimer(this, type, name); + if (this.streamStarted) { + timer.markAdsStreamStarted(); + } authorityMap.set(name.key, timer); if (!delaySend) { this.updateNames(type); @@ -502,6 +506,7 @@ class AdsCallState { * stream. */ markStreamStarted() { + this.streamStarted = true; for (const [type, typeState] of this.typeStates) { for (const [authority, authorityMap] of typeState.subscribedResources) { for (const resourceTimer of authorityMap.values()) {