Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grpc-js-xds: Start resource timers for resources requested after stream start #2882

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/grpc-js-xds/src/xds-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ class AdsCallState {
public typeStates: Map<XdsResourceType, ResourceTypeState> = 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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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()) {
Expand Down
Loading