fix: detect gateway close and failure to reconnect

This commit is contained in:
2026-04-16 02:01:50 -04:00
parent 6a1d8f060f
commit 6cd7f00028

View File

@@ -337,11 +337,14 @@ async fn handle_events(command_router: Arc<CommandRouter>, state: State, mut sha
.await .await
{ {
match event_res { match event_res {
Ok(twilight_model::gateway::event::Event::GatewayClose(frame_option)) => {
tracing::warn!(?frame_option);
return;
}
Ok(event) => { Ok(event) => {
handle_event(command_router.clone(), state.clone(), event).await; handle_event(command_router.clone(), state.clone(), event).await;
} }
Err(twilight_model::gateway::event::Event::GatewayClose(frame_option)) => { Err(reconnect_error) if reconnect_error.kind() == twilight_gateway::error::ReceiveMessageErrorType::Reconnect => {
tracing::warn!(?frame_option);
return; return;
} }
Err(error) => { Err(error) => {