Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
run client worker directly in main
Browse files Browse the repository at this point in the history
  • Loading branch information
Sir-Photch committed Oct 1, 2023
1 parent d9d44f2 commit ca0f6df
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,27 +178,8 @@ async fn main() {
.expect("Error creating client");

let exec_start = Utc::now();

let client_handle = tokio::spawn(async move {
client
.start()
.await
.map_err(|err| error!("Client error: {err:?}"))
});

if let Err(why) = tokio::signal::ctrl_c().await {
error!("ctrl-c error: {why:?}");
}

info!(
"Received interrupt. Session lasted {}. Exiting...",
Utc::now() - exec_start
);

client_handle.abort();
if let Err(why) = client_handle.await {
if why.is_panic() {
error!("==> Client task panicked: {why:?}");
}

if let Err(why) = client.start().await {
error!("Client error: {why:?}");
}
}

0 comments on commit ca0f6df

Please sign in to comment.