mirror of
https://github.com/Xevion/banner.git
synced 2026-01-31 12:23:33 -06:00
Replace DayOfWeek with chrono::Weekday via extension traits, unify RateLimitConfig into the config module, and remove the unused time command, BannerState, and ClassDetails stub. Fix open_only query parameter to respect false values and correct 12-hour time display.
19 lines
675 B
Rust
19 lines
675 B
Rust
use tokio::task::JoinHandle;
|
|
use tracing::warn;
|
|
|
|
/// Helper for joining multiple task handles with proper error handling.
|
|
///
|
|
/// This function waits for all tasks to complete and reports any that panicked.
|
|
/// Returns an error if any task panicked, otherwise returns Ok.
|
|
pub async fn join_tasks(handles: Vec<JoinHandle<()>>) -> Result<(), anyhow::Error> {
|
|
let results = futures::future::join_all(handles).await;
|
|
|
|
let failed = results.iter().filter(|r| r.is_err()).count();
|
|
if failed > 0 {
|
|
warn!(failed_count = failed, "Some tasks panicked during shutdown");
|
|
Err(anyhow::anyhow!("{} task(s) panicked", failed))
|
|
} else {
|
|
Ok(())
|
|
}
|
|
}
|