Skip to content

Commit

Permalink
Merge branch 'main' into fix/ani-random
Browse files Browse the repository at this point in the history
  • Loading branch information
shanimal08 authored Nov 28, 2024
2 parents 87adfdb + ae8d25d commit 3fd0fe6
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src-tauri/src/process_watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,10 @@ impl<TAdapter: ProcessAdapter> ProcessWatcher<TAdapter> {
_ = watch_timer.tick() => {
let status_monitor3 = status_monitor2.clone();

let exit_code = do_health_check(&mut child, status_monitor3, name.clone(), &mut uptime, expected_startup_time, health_timeout, app_shutdown.clone(), inner_shutdown.clone(), &mut warning_count).await?;
let exit_code = do_health_check(&mut child, status_monitor3, name.clone(), &mut uptime, expected_startup_time, health_timeout, app_shutdown.clone(), inner_shutdown.clone(), &mut warning_count, &stop_on_exit_codes).await?;
if exit_code != 0 {
if stop_on_exit_codes.contains(&exit_code) {
return Ok(exit_code);
}
warn!(target: LOG_TARGET, "{} exited with error code: {}, restarting because it is not a listed exit code to list for", name, exit_code);

}
return Ok(exit_code);
}
// break;
},
_ = inner_shutdown.wait() => {
Expand Down Expand Up @@ -159,6 +155,7 @@ async fn do_health_check<T: StatusMonitor>(
app_shutdown: ShutdownSignal,
inner_shutdown: ShutdownSignal,
warning_count: &mut u32,
stop_on_exit_codes: &[i32],
) -> Result<i32, anyhow::Error> {
let mut is_healthy = false;

Expand Down Expand Up @@ -209,9 +206,12 @@ async fn do_health_check<T: StatusMonitor>(
match child.stop().await {
Ok(exit_code) => {
if exit_code != 0 {
error!(target: LOG_TARGET, "{} exited with error code: {}", name, exit_code);
// Do not restart on non-zero exit code. This will just keep happening.
return Ok(exit_code);
if stop_on_exit_codes.contains(&exit_code) {
return Ok(exit_code);
}
warn!(target: LOG_TARGET, "{} exited with error code: {}, restarting because it is not a listed exit code to list for", name, exit_code);

// return Ok(exit_code);
} else {
info!(target: LOG_TARGET, "{} exited successfully", name);
}
Expand Down

0 comments on commit 3fd0fe6

Please sign in to comment.