fix: scope the vcs_watcher borrow to possibly fix deadlock
This commit is contained in:
@@ -234,7 +234,7 @@ impl EventHandler for Handler {
|
|||||||
#[tracing::instrument(skip(state))]
|
#[tracing::instrument(skip(state))]
|
||||||
pub async fn handle(state: State, interaction: Interaction) {
|
pub async fn handle(state: State, interaction: Interaction) {
|
||||||
let guild_and_voice_channel_id_res =
|
let guild_and_voice_channel_id_res =
|
||||||
get_guild_and_voice_channel_id(&interaction, &state.vcs_watcher.borrow());
|
{ get_guild_and_voice_channel_id(&interaction, &state.vcs_watcher.borrow()) };
|
||||||
let (guild_id, voice_channel_id) = match guild_and_voice_channel_id_res {
|
let (guild_id, voice_channel_id) = match guild_and_voice_channel_id_res {
|
||||||
Ok((guild_id, voice_channel_id)) => (guild_id, voice_channel_id),
|
Ok((guild_id, voice_channel_id)) => (guild_id, voice_channel_id),
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
|
|||||||
@@ -80,11 +80,13 @@ fn get_guild_and_vc_error_to_embed(error: GetGuildAndVoiceChannelIdError) -> Emb
|
|||||||
|
|
||||||
#[tracing::instrument]
|
#[tracing::instrument]
|
||||||
pub async fn handle(state: State, interaction: Interaction) {
|
pub async fn handle(state: State, interaction: Interaction) {
|
||||||
let user_and_guild_and_voice_channel_id_res = get_user_and_guild_and_voice_channel_id(
|
let user_and_guild_and_voice_channel_id_res = {
|
||||||
state.discord_user_id,
|
get_user_and_guild_and_voice_channel_id(
|
||||||
&interaction,
|
state.discord_user_id,
|
||||||
&state.vcs_watcher.borrow(),
|
&interaction,
|
||||||
);
|
&state.vcs_watcher.borrow(),
|
||||||
|
)
|
||||||
|
};
|
||||||
let (user_id, guild_id, voice_channel_id) = match user_and_guild_and_voice_channel_id_res {
|
let (user_id, guild_id, voice_channel_id) = match user_and_guild_and_voice_channel_id_res {
|
||||||
Ok((user_id, guild_id, voice_channel_id)) => (user_id, guild_id, voice_channel_id),
|
Ok((user_id, guild_id, voice_channel_id)) => (user_id, guild_id, voice_channel_id),
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user