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
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:zk.exists
takes a lot longer than the specified 1 second in theconnect
method. It takes like a half a minute minute to fail