From c351511c8a5225c045bcf2e4925b9a8b950a399a Mon Sep 17 00:00:00 2001 From: Jacob Date: Sun, 24 May 2026 16:35:37 -0400 Subject: [PATCH] fix: set the cancellation token when discord disconnects --- src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index d6d155e..8827d3a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -467,7 +467,7 @@ async fn handle_events(command_router: Arc, state: State, mut sha match event_res { Ok(twilight_model::gateway::event::Event::GatewayClose(frame_option)) => { tracing::warn!(?frame_option); - return; + break; } Ok(event) => { handle_event(command_router.clone(), state.clone(), event).await; @@ -479,13 +479,15 @@ async fn handle_events(command_router: Arc, state: State, mut sha ) => { tracing::error!(?reconnect_error); - return; + break; } Err(error) => { tracing::error!(?error); } } } + + state.cancellation_token.cancel(); } #[tracing::instrument(skip(command_router, state))]