Skip to content

Commit

Permalink
Merge pull request #67 from golemfactory/terminate-on-finish
Browse files Browse the repository at this point in the history
Gracefully shutdown runtime will set Terminated state
  • Loading branch information
nieznanysprawiciel authored Feb 28, 2024
2 parents b4f8a38 + 61179cf commit a657125
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,15 +426,21 @@ async fn run<RUNTIME: process::Runtime + Clone + Unpin + 'static>(
signal = signal_receiver.recv() => {
if let Some(signal) = signal {
log::debug!("Received signal {signal}. Stopping runtime");

ctx.process_controller.stop().await
.context("Stopping runtime error")?;
.context("Stopping runtime error")?;
}
Ok(())
},
}
.context("Activity loop error")?;

log::info!("Finished waiting");
send_state(
&ctx,
ActivityState::from(StatePair(State::Terminated, None)),
)
.await?;

Ok(())
}

0 comments on commit a657125

Please sign in to comment.