Browse Source

Add delay between registration attempts

translation
Colin Reeder 4 years ago
parent
commit
7fe4b2fc74
1 changed files with 9 additions and 5 deletions
  1. +9
    -5
      src/pairing.rs

+ 9
- 5
src/pairing.rs View File

@@ -65,12 +65,16 @@ impl PairingManager {
.or_else(|(bridges, i, err)| {
match err {
huey::HueError::LinkButtonNotPressed => {
let i = if i + 1 < bridges.len() {
i + 1
if i + 1 < bridges.len() {
run(bridges, i + 1)
} else {
0
};
run(bridges, i)
Box::new(tokio::timer::Delay::new(std::time::Instant::now() + std::time::Duration::from_millis(400))
.or_else(|err| {
eprintln!("Timer failed: {:?}", err);
Ok(())
})
.and_then(|_| run(bridges, 0)))
}
},
other_err => {
Box::new(futures::future::err((bridges, i, other_err)))


Loading…
Cancel
Save