Skip to content

Commit

Permalink
Merge pull request #496 from dora-rs/robust-up
Browse files Browse the repository at this point in the history
Fix: Wait until dora daemon is connected to coordinator on `dora up`
  • Loading branch information
phil-opp authored May 3, 2024
2 parents d6f13d0 + 00df8f2 commit 20cb68c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions binaries/cli/src/up.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ pub(crate) fn up(config_path: Option<&Path>) -> eyre::Result<()> {

if !daemon_running(&mut *session)? {
start_daemon().wrap_err("failed to start dora-daemon")?;

// wait a bit until daemon is connected
let mut i = 0;
const WAIT_S: f32 = 0.1;
loop {
if daemon_running(&mut *session)? {
break;
}
i += 1;
if i > 20 {
eyre::bail!("daemon not connected after {}s", WAIT_S * i as f32);
}
std::thread::sleep(Duration::from_secs_f32(WAIT_S));
}
}

Ok(())
Expand Down

0 comments on commit 20cb68c

Please sign in to comment.