This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new c35c6f2 fix consul repeated invoker KVCache.newCache (#3833)
c35c6f2 is described below
commit c35c6f2a2e39f6a0330047e1d8eac6b3cd6bc8ea
Author: zhang-wei <[email protected]>
AuthorDate: Mon Nov 11 22:26:21 2019 +0800
fix consul repeated invoker KVCache.newCache (#3833)
---
.../configuration/consul/ConsulConfigurationWatcherRegister.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git
a/oap-server/server-configuration/configuration-consul/src/main/java/org/apache/skywalking/oap/server/configuration/consul/ConsulConfigurationWatcherRegister.java
b/oap-server/server-configuration/configuration-consul/src/main/java/org/apache/skywalking/oap/server/configuration/consul/ConsulConfigurationWatcherRegister.java
index 1fb1d00..2e58784 100644
---
a/oap-server/server-configuration/configuration-consul/src/main/java/org/apache/skywalking/oap/server/configuration/consul/ConsulConfigurationWatcherRegister.java
+++
b/oap-server/server-configuration/configuration-consul/src/main/java/org/apache/skywalking/oap/server/configuration/consul/ConsulConfigurationWatcherRegister.java
@@ -93,7 +93,10 @@ public class ConsulConfigurationWatcherRegister extends
ConfigWatcherRegister {
}
private void registerKeyListeners(final Set<String> keys) {
- keys.forEach(key -> {
+ final Set<String> unregisterKeys = new HashSet<>(keys);
+ unregisterKeys.removeAll(cachesByKey.keySet());
+
+ unregisterKeys.forEach(key -> {
KVCache cache = KVCache.newCache(consul, key);
cache.addListener(newValues -> {
Optional<Value> value = newValues.values().stream().filter(it
-> key.equals(it.getKey())).findAny();