Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(recipe): add ExistingDataWatch class #648

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Jun 2, 2022

  1. feat(recipe): add ExistingDataWatch class

    This adds a subclass of DataWatch which only operates on existing
    ZNodes.  If a user uses a DataWatch on a path and the ZNode at that
    path is deleted, the DataWatch will still issue an "exists" call
    and set a watch right before the final callback.  That means that
    regardless of the return value of the callback and whether or not
    Kazoo will invoke the callback again, the ZooKeeper server still
    has a watch entry for that path.
    
    In short, using a DataWatch on a path and then deleting that path
    can leak watch entries on the ZooKeeper server.
    
    Because the DataWatch recipe is designed to watch non-existing paths,
    this behavior may be desired and relied on by some users, so it's
    not considered a bug.  But other users may want to use DataWatches
    for nodes where this behavior would be a problem.
    
    The ExistingDataWatch class behaves similarly to its parent class,
    DataWatch, but it does not set a watch on paths which do not exist
    (whether that's because they never existed or were recently deleted).
    This means that a user of an ExistingDataWatch can be assured that
    after the callback with the deleted event, the watch is removed from
    the server.
    jeblair authored and ceache committed Jun 2, 2022
    Configuration menu
    Copy the full SHA
    48f5412 View commit details
    Browse the repository at this point in the history