spring-cloud-consul icon indicating copy to clipboard operation
spring-cloud-consul copied to clipboard

Too many refresh events published from ConfigWatch

Open dahamr opened this issue 10 years ago • 2 comments

We have a reasonably complex set of services all of which are configured to watch for consul changes. Because of https://github.com/spring-cloud/spring-cloud-consul/issues/183, I've been looking for ways to reduce the number of refresh events.

What I've noticed is that refresh events are issued when no KVs related to the service have changed. I found that if a prefix does not exist, the X-Consul-Index value could match the ModifyIndex of a key in a completely different area. In that case, the query made to consul returns a 404 along with new X-Consul-Index. The refresh events I am questing all seem to be related to missing prefixes.

I'm wondering if it is necessary to publish a refresh event in this scenario where the value is null and the query to check for the prefix returns a 404? I tested the minor change to ConfigWatch to skip the refresh if the value is null and it seems to work like I'd want.

dahamr avatar Sep 15 '16 18:09 dahamr

Sweet, how about a PR?

spencergibb avatar Sep 15 '16 19:09 spencergibb

The code change isn't really interesting but I submitted it. We are at 1.0.2.RELEASE but the PR is for master.

dahamr avatar Sep 15 '16 19:09 dahamr