spring-cloud / spring-cloud-consul

Spring Cloud Consul
http://cloud.spring.io/spring-cloud-consul/
Apache License 2.0
813 stars 541 forks source link

ConfigWatch doesn't publish update-event after Consul restarting even when value was changed #731

Open llextor opened 3 years ago

llextor commented 3 years ago

Describe the bug Version: 2.2.7.RELEASE This is floating bug. ConfigWatch holds last saved index, but after Consul restarting, Consul can set same index for value therefore ConfigWatch doesn't publish updating event.

if (!this.consulIndexes.containsValue(newIndex) && !currentIndex.equals(-1L)) {
        log.trace("Context " + context + " has new index "+ newIndex);
    RefreshEventData data = new RefreshEventData(context, currentIndex, newIndex);
    this.publisher.publishEvent(new RefreshEvent(this, data, data.toString()));

Sample

  1. Put KV
  2. Restart Consul
  3. Put same key with changed value in Consul AR: ConsulWatch didn't publish update event ER: ConsulWatch published update event