Skip to content

Commit

Permalink
handle exits properly
Browse files Browse the repository at this point in the history
  • Loading branch information
kylerchin committed Nov 25, 2024
1 parent 29d0549 commit f87ae23
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ rand = "0.8.5"
titlecase = "3.2"
rayon = "1.8.0"
chrono = "0.4.31"
geo-types = "0.7.13"
geo-types = "0.7.14"
geo-postgis = "0.2.2"
geo = "0.28.0"
tarpc = {version = "0.34.0", features = ["full"]}
geo = "0.29.0"
tarpc = {version = "0.35.0", features = ["full"]}
anyhow = "1.0.75"
tracing = "0.1.40"
tokio-serde = "0.9"
Expand All @@ -72,7 +72,7 @@ dmfr = "0.1.0"
chateau = {git = "https://github.com/catenarytransit/chateau"}
dmfr-dataset-reader = "0.2.0"
uuid = {version = "1.8.0", features = ["v4", "fast-rng", "macro-diagnostics"]}
zip = "2.2.0"
zip = "2.2.1"
git2 = "0.19"
zip-extract = "0.2.1"
serde_derive = "1.0.197"
Expand Down
24 changes: 17 additions & 7 deletions src/aspen/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -837,13 +837,23 @@ async fn main() -> anyhow::Result<()> {
}
}());

let result_series = tokio::try_join!(
leader_thread_handler,
async_from_alpenrose_processor_handler,
tarpc_server,
etcd_lease_renewer
);
async fn flatten<T>(handle: tokio::task::JoinHandle<Result<T, Box<dyn Error + Sync + Send>>>) -> Result<T, Box<dyn Error + Sync + Send>> {
match handle.await {
Ok(Ok(result)) => Ok(result),
Ok(Err(err)) => Err(err),
Err(err) => Err(Box::new(err)),
}
}

let result_series = tokio::try_join!(
flatten(leader_thread_handler),
flatten(async_from_alpenrose_processor_handler),
flatten(tarpc_server),
flatten(etcd_lease_renewer)
).unwrap();

Ok(())
/*
match result_series {
Ok(result_series_ok) => {
println!("All threads have exited");
Expand Down Expand Up @@ -883,7 +893,7 @@ async fn main() -> anyhow::Result<()> {
panic!("{:#?}", e);
Err(anyhow::Error::new(e))
}
}
}*/
}

enum SaveTimestamp {
Expand Down

0 comments on commit f87ae23

Please sign in to comment.