fix: set the cancellation token when discord disconnects

This commit is contained in:
2026-05-24 16:35:37 -04:00
parent d373352ae1
commit c351511c8a

View File

@@ -467,7 +467,7 @@ async fn handle_events(command_router: Arc<CommandRouter>, state: State, mut sha
match event_res { match event_res {
Ok(twilight_model::gateway::event::Event::GatewayClose(frame_option)) => { Ok(twilight_model::gateway::event::Event::GatewayClose(frame_option)) => {
tracing::warn!(?frame_option); tracing::warn!(?frame_option);
return; break;
} }
Ok(event) => { Ok(event) => {
handle_event(command_router.clone(), state.clone(), event).await; handle_event(command_router.clone(), state.clone(), event).await;
@@ -479,13 +479,15 @@ async fn handle_events(command_router: Arc<CommandRouter>, state: State, mut sha
) => ) =>
{ {
tracing::error!(?reconnect_error); tracing::error!(?reconnect_error);
return; break;
} }
Err(error) => { Err(error) => {
tracing::error!(?error); tracing::error!(?error);
} }
} }
} }
state.cancellation_token.cancel();
} }
#[tracing::instrument(skip(command_router, state))] #[tracing::instrument(skip(command_router, state))]