Merge pull request #109 from DeterminateSystems/colemickens/shutdown
shutdown: wait for flakehub_cache first
This commit is contained in:
commit
cf183317a5
|
@ -99,17 +99,23 @@ async fn workflow_finish(
|
||||||
gha_cache.shutdown().await?;
|
gha_cache.shutdown().await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(attic_state) = state.flakehub_state.write().await.take() {
|
||||||
|
tracing::info!("Waiting for FlakeHub cache uploads to finish");
|
||||||
|
let paths = attic_state.push_session.wait().await?;
|
||||||
|
|
||||||
|
let paths = paths.keys().map(|s| s.name()).collect::<Vec<_>>();
|
||||||
|
|
||||||
|
tracing::info!(?paths, "FlakeHub Cache uploads completed");
|
||||||
|
} else {
|
||||||
|
tracing::info!("FlakeHub cache is not enabled, not uploading anything to it");
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(sender) = state.shutdown_sender.lock().await.take() {
|
if let Some(sender) = state.shutdown_sender.lock().await.take() {
|
||||||
sender
|
sender
|
||||||
.send(())
|
.send(())
|
||||||
.map_err(|_| Error::Internal("Sending shutdown server message".to_owned()))?;
|
.map_err(|_| Error::Internal("Sending shutdown server message".to_owned()))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(attic_state) = state.flakehub_state.write().await.take() {
|
|
||||||
tracing::info!("Waiting for FlakeHub cache uploads to finish");
|
|
||||||
let _paths = attic_state.push_session.wait().await?;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE(cole-h): see `init_logging`
|
// NOTE(cole-h): see `init_logging`
|
||||||
if let Some(logfile) = &state.logfile {
|
if let Some(logfile) = &state.logfile {
|
||||||
let logfile_contents = std::fs::read_to_string(logfile)
|
let logfile_contents = std::fs::read_to_string(logfile)
|
||||||
|
|
|
@ -354,7 +354,7 @@ async fn main_cli() -> Result<()> {
|
||||||
Some(state)
|
Some(state)
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
tracing::debug!("FlakeHub cache initialization failed: {}", err);
|
tracing::error!("FlakeHub cache initialization failed: {}", err);
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue