Skip to content

Commit 041809d

Browse files
committed
revert back changes and cleanup nonce if subscription is empty
Signed-off-by: Megrez Lu <[email protected]>
1 parent 3da29af commit 041809d

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public void run() {
133133
xdsTransport.shutdown();
134134
}
135135
});
136-
}
136+
}r
137137

138138
@Override
139139
public String toString() {
@@ -152,8 +152,12 @@ void adjustResourceSubscription(XdsResourceType<?> resourceType) {
152152
startRpcStream();
153153
}
154154
Collection<String> resources = resourceStore.getSubscribedResources(serverInfo, resourceType);
155-
adsStream.sendDiscoveryRequest(resourceType,
156-
resources == null ? Collections.emptySet() : resources);
155+
if (resources != null) {
156+
adsStream.sendDiscoveryRequest(resourceType, resources);
157+
} else {
158+
// cleanup the nonce for the resource type if it's not subscribed to anymore.
159+
adsStream.respNonces.remove(resourceType);
160+
}
157161
}
158162

159163
/**

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ public void run() {
291291
}
292292
if (resourceSubscribers.get(type).isEmpty()) {
293293
resourceSubscribers.remove(type);
294+
subscribedResourceTypeUrls.remove(type.typeUrl());
294295
}
295296
}
296297
}

0 commit comments

Comments
 (0)