fix: set the cancellation token when discord disconnects
This commit is contained in:
@@ -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))]
|
||||||
|
|||||||
Reference in New Issue
Block a user