grpc-js-xds: Preserve resource type version and nonce when unsubscribing #2879
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #2875 by never deleting
typeStates
entries inAdsCallState
once they are created. As a result, the nonce will persist for the duration of the ADS stream. In addition, handling nonces for unknown types is not an issue because a type stays known for the duration of the stream after it is requested once, and we do not guarantee handling of the case where a control plane sends a resource type that was never requested.The only functional impact that I can see of this change is that it will send a
DiscoveryRequest
with an emptyresource_names
list after unsubscribing from the last resource of a particular type, and I believe that is the correct behavior.This should not meaningfully impact resource usage, because a type state with no resources is just two strings and an empty map, and there are at most 4 for a given stream, and the lifetime is limited to the lifetime of the stream.