Skip to content

Commit

Permalink
ZKMetadataStore: Ignore the event for root node
Browse files Browse the repository at this point in the history
Turns out Linux emits a `node created` event for the node a bit later.
Therefore, even if we add a listened after creating a root node,
we still may catch it in the listener
  • Loading branch information
artembilan committed Sep 15, 2022
1 parent 878f8cd commit f39ad6f
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,10 @@ public void event(Type type, ChildData oldData, ChildData newData) {
ChildData data = Type.NODE_DELETED.equals(type) ? oldData : newData;
String eventPath = data.getPath();
String eventKey = getKey(eventPath);
if (ZookeeperMetadataStore.this.root.equals(eventKey)) {
// Ignore the root node for metadata tree
return;
}
String value = IntegrationUtils.bytesToString(data.getData(), ZookeeperMetadataStore.this.encoding);

switch (type) {
Expand Down

0 comments on commit f39ad6f

Please sign in to comment.