Skip to content

Commit

Permalink
[utils] Warn on runtime_error when waiting for SSH
Browse files Browse the repository at this point in the history
Transitioning away from generic runtime errors to signal normal SSH
waiting conditions by warning when they are caught, but still retrying
for the time being.
  • Loading branch information
ricab committed Jun 28, 2023
1 parent 21b90b1 commit d86eaf1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ QString find_autostart_target(const QString& subdir, const QString& autostart_fi
}

template <typename ExceptionT>
mp::utils::TimeoutAction log_and_retry(const ExceptionT& e, const mp::VirtualMachine* vm)
mp::utils::TimeoutAction log_and_retry(const ExceptionT& e, const mp::VirtualMachine* vm,
mpl::Level log_level = mpl::Level::trace)
{
assert(vm);
mpl::log(mpl::Level::trace, vm->vm_name, e.what());
mpl::log(log_level, vm->vm_name, e.what());
return mp::utils::TimeoutAction::retry;
};
} // namespace
Expand Down Expand Up @@ -348,6 +349,10 @@ void mp::utils::wait_until_ssh_up(VirtualMachine* virtual_machine, std::chrono::
{
return log_and_retry(e, virtual_machine);
}
catch (const std::runtime_error& e) // transitioning away from catching generic runtime errors
{ // TODO remove once we're confident this is an anomaly
return log_and_retry(e, virtual_machine, mpl::Level::warning);
}
};

auto on_timeout = [virtual_machine] {
Expand Down

0 comments on commit d86eaf1

Please sign in to comment.