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

ZooKeeper::connect doesn't crash if it can not connect #64

Open
Jasperav opened this issue Jan 5, 2020 · 0 comments
Open

ZooKeeper::connect doesn't crash if it can not connect #64

Jasperav opened this issue Jan 5, 2020 · 0 comments

Comments

@Jasperav
Copy link

Jasperav commented Jan 5, 2020

I don't have any ZooKeeper server running, but ZooKeeper::connect will not throw an error. My expectation is that if it can not connect, it notifies me. Furthermore, take this code:

use zookeeper::{ZooKeeper, Watcher, WatchedEvent};
use std::time::Duration;

struct LoggingWatcher;
impl Watcher for LoggingWatcher {
    fn handle(&self, e: WatchedEvent) {
        println!("{:?}", e)
    }
}

fn main() {
    // Some url where zookeeper isn't running
    let url = "129.0.0.1:2182";
    let zk = ZooKeeper::connect(url, Duration::from_secs(1), LoggingWatcher).unwrap();

    zk.add_listener(|s| println!("New state is {:?}", s));

    let x = zk.exists("/test", false).unwrap();

    println!("Connected!");
}

zk.exists takes a lot longer than the specified 1 second in the connect method. It takes like a half a minute minute to fail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant