Skip to content

Commit c2da8a0

Browse files
committed
Send unsubscribing DiscoveryRequest
1 parent c84946a commit c2da8a0

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

xds/src/main/java/io/grpc/xds/client/ControlPlaneClient.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,11 @@ void adjustResourceSubscription(XdsResourceType<?> resourceType) {
152152
startRpcStream();
153153
}
154154
Collection<String> resources = resourceStore.getSubscribedResources(serverInfo, resourceType);
155-
if (resources != null) {
156-
adsStream.sendDiscoveryRequest(resourceType, resources);
157-
} else {
155+
if (resources == null) {
156+
resources = Collections.emptyList();
157+
}
158+
adsStream.sendDiscoveryRequest(resourceType, resources);
159+
if (resources.isEmpty()) {
158160
// The resource type no longer has subscribing resources; clean up references to it
159161
versions.remove(resourceType);
160162
adsStream.respNonces.remove(resourceType);

xds/src/test/java/io/grpc/xds/GrpcXdsClientImplTestBase.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2781,6 +2781,7 @@ public void edsCleanupNonceAfterUnsubscription() {
27812781
// trigger an EDS resource unsubscription.
27822782
xdsClient.cancelXdsResourceWatch(XdsEndpointResource.getInstance(), "A.1", edsResourceWatcher);
27832783
verifySubscribedResourcesMetadataSizes(0, 0, 0, 0);
2784+
call.verifyRequest(EDS, Arrays.asList(), VERSION_1, "0000", NODE);
27842785

27852786
// When re-subscribing, the version and nonce were properly forgotten, so the request is the
27862787
// same as the initial request

0 commit comments

Comments
 (0)