So I ran into another issue, which i cannot seem to figure out. I want to listen for changes to a table, but only for a while, then I want to stop and do other things.
Looking at the code I found that there is Response.poll() , which should return a status, my plan was to use that and poll for data, getting the data when possible, or otherwise just timeout after enough time had passed, this way i could offload checking the entire table for changes to the data.
So i tried this, and it compiles:
let r = Client::new();
// Create a connection pool
println!("Connecting");
let conn = r.connect(conf).unwrap();
let now = Instant::now();
let mut query = r.db("rethinkdb")
.table("server_status")
.changes()
.run::<Change<ServerStatus, ServerStatus>>(conn).unwrap();
loop {
println!("loop");
match query.poll() {
Ok(n) => {
println!("{:?}", n);
},
_ => break,
}
if now.elapsed().as_secs() > 30 {
break;
}
}
But it crashes with:
thread 'main' panicked at 'no Task is currently running', libcore/option.rs:1010:5
Hi again
So I ran into another issue, which i cannot seem to figure out. I want to listen for changes to a table, but only for a while, then I want to stop and do other things.
Looking at the code I found that there is
Response.poll()
, which should return a status, my plan was to use that and poll for data, getting the data when possible, or otherwise just timeout after enough time had passed, this way i could offload checking the entire table for changes to the data.So i tried this, and it compiles:
But it crashes with:
thread 'main' panicked at 'no Task is currently running', libcore/option.rs:1010:5