Skip to content

Commit

Permalink
feat: crash app with entire stack trace
Browse files Browse the repository at this point in the history
  • Loading branch information
wvffle committed Nov 4, 2024
1 parent e09e000 commit c959da7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 45 deletions.
48 changes: 10 additions & 38 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ async fn main() -> Result<()> {
color_eyre::install()?;
tracing_subscriber::fmt::init();

info!("Cracktorio bot started");

let (tx, rx) = mpsc::channel::<Signal>(1);

let scrapper = tasks::scrapper::run(tx.clone());
Expand All @@ -28,51 +30,21 @@ async fn main() -> Result<()> {
tokio::select! {
_ = tokio::signal::ctrl_c() => { info!("Shutting down..."); },
result = tokio::spawn(scrapper) => {
match result {
Err(e) => {
error!("Scrapper task failed: {}", e);
}
Ok(()) => {
info!("Scrapper task finished");
}
}
info!("Scrapper task finished");
result?;
},

result = tokio::spawn(factorio) => {
match result {
Err(e) => {
error!("Factorio log reading task failed: {}", e);
}
Ok(Err(e)) => {
error!("Factorio log reading task failed: {}", e);
}
Ok(Ok(())) => {
info!("Factorio log reading task finished");
}
}
info!("Factorio log reading task finished");
result??;
},
result = tokio::spawn(telegram) => {
match result {
Err(e) => {
error!("Telegram message receiving task failed: {}", e);
}
Ok(Err(e)) => {
error!("Telegram message receiving task failed: {}", e);
}
Ok(Ok(())) => {
info!("Telegram message receiving task finished");
}
}
info!("Telegram message receiving task finished");
result??;
},
result = tokio::spawn(bridge(rx)) => {
match result {
Err(e) => {
error!("Bridge task failed: {}", e);
}
Ok(()) => {
info!("Bridge task finished");
}
}
info!("Bridge task finished");
result?;
},
}

Expand Down
14 changes: 7 additions & 7 deletions src/tasks/factorio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ use tokio::sync::mpsc;
use tracing::{error, info};

pub async fn run(tx: mpsc::Sender<Signal>) -> Result<()> {
if CONFIG.retry {
loop {
if let Err(e) = create_reader(&tx).await {
error!("Error reading log file: {}", e);
}
}
}
// if CONFIG.retry {
// loop {
// if let Err(e) = create_reader(&tx).await {
// error!("Error reading log file: {}", e);
// }
// }
// }

create_reader(&tx).await?;

Expand Down

0 comments on commit c959da7

Please sign in to comment.