From 6cd7f000282e45a68033516cfac8e895d8a5ba11 Mon Sep 17 00:00:00 2001 From: Jacob Date: Thu, 16 Apr 2026 02:01:50 -0400 Subject: [PATCH] fix: detect gateway close and failure to reconnect --- src/main.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 09f8030..0a155bd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -337,11 +337,14 @@ async fn handle_events(command_router: Arc, state: State, mut sha .await { match event_res { + Ok(twilight_model::gateway::event::Event::GatewayClose(frame_option)) => { + tracing::warn!(?frame_option); + return; + } Ok(event) => { handle_event(command_router.clone(), state.clone(), event).await; } - Err(twilight_model::gateway::event::Event::GatewayClose(frame_option)) => { - tracing::warn!(?frame_option); + Err(reconnect_error) if reconnect_error.kind() == twilight_gateway::error::ReceiveMessageErrorType::Reconnect => { return; } Err(error) => {