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

Unexpected notice for zk data change

Open 24kpure opened this issue 1 year ago • 8 comments

https://github.com/spring-cloud/spring-cloud-zookeeper/blob/b0e12877120771cb1f223c4c69234a25758b07a9/spring-cloud-zookeeper-config/src/main/java/org/springframework/cloud/zookeeper/config/ConfigWatcher.java#L116C4-L117C72

image

24kpure avatar Aug 30 '24 08:08 24kpure

Though data has bean created or modified for a long time before application start ,curator still publish a event about node create.Ignoring event whose modify time is out of date may be a good way.

   public void childEvent(CuratorFramework client, TreeCacheEvent event)
           throws Exception {
      TreeCacheEvent.Type eventType = event.getType();
       if (eventType != NODE_ADDED && eventType != NODE_REMOVED
               && eventType != NODE_UPDATED) {
           return;
       }

       // ignore event whose modify time is out of date
       String path = event.getData().getPath();
       long validTime = System.currentTimeMillis() - TimeUnit.MINUTES.toMillis(1);
       if (eventType == NODE_ADDED
               && event.getData().getStat().getMtime() < validTime) {
           return;
       }

       this.publisher.publishEvent(new RefreshEvent(this, event, getEventDesc(event)));
}

24kpure avatar Aug 30 '24 09:08 24kpure

@spencergibb @OlgaMaciaszek

24kpure avatar Sep 19 '24 09:09 24kpure

Obviously, we don't control notifications from curator. What problem is this causing?

spencergibb avatar Oct 02 '24 18:10 spencergibb

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-cloud-issues avatar Oct 09 '24 18:10 spring-cloud-issues

Obviously, we don't control notifications from curator. What problem is this causing?

It's not nessary to listen data which has bean created or modified for a long time before application start.

24kpure avatar Oct 16 '24 10:10 24kpure

PRs welcome

spencergibb avatar Oct 16 '24 15:10 spencergibb

fix in #337

24kpure avatar Nov 13 '24 10:11 24kpure

PRs welcome

@spencergibb I have raised a pr for 3 weeks, should someone cr?

24kpure avatar Dec 03 '24 10:12 24kpure