fix: When the client id of an application is changed, its subscriptions must be updated with this new client id
This closes gravitee-io/issues#1287
@@ -149,6 +149,13 @@ public class SubscriptionRefresher implements Runnable {
LOGGER.debug("Cache a subscription: plan[{}] application[{}] client_id[{}]", subscription.getPlan(), subscription.getApplication(), subscription.getClientId());
cache.put(new Element(subscription.getId(), key));
cache.put(new Element(key, subscription));
+
+ if (element != null) {
+ final String oldKey = (String) element.getObjectValue();
+ if (!oldKey.equals(key)) {
+ cache.remove(oldKey);
+ }
+ }
}
}
