Skip to content

Commit

Permalink
move graceful shutdown to s3 load
Browse files Browse the repository at this point in the history
  • Loading branch information
eaypek-tfh committed Jan 24, 2025
1 parent 08a202a commit e4a7a3b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions iris-mpc/src/bin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,6 @@ async fn server_main(config: Config) -> eyre::Result<()> {
let db_chunks_bucket_name = config.db_chunks_bucket_name.clone();
let db_chunks_folder_name = config.db_chunks_folder_name.clone();
let download_shutdown_handler = Arc::clone(&shutdown_handler);
let env = config.environment.clone();

let (tx, rx) = oneshot::channel();
background_tasks.spawn_blocking(move || {
Expand Down Expand Up @@ -1255,10 +1254,6 @@ async fn server_main(config: Config) -> eyre::Result<()> {
load_chunks_parallelism
);
load_summary_ts = Instant::now();
if download_shutdown_handler.is_shutting_down() {
tracing::warn!("Shutdown requested by shutdown_handler.");
return Err(eyre::eyre!("Shutdown requested"));
}
}

let min_last_modified_at = last_snapshot_details.timestamp
Expand Down Expand Up @@ -1342,6 +1337,10 @@ async fn server_main(config: Config) -> eyre::Result<()> {
elapsed,
record_counter as f64 / elapsed.as_secs_f64()
);
if download_shutdown_handler.is_shutting_down() {
tracing::warn!("Shutdown requested by shutdown_handler.");
return Err(eyre::eyre!("Shutdown requested"));
}
}

time_loading_into_memory += load_summary_ts.elapsed();
Expand Down

0 comments on commit e4a7a3b

Please sign in to comment.