fix: scope the vcs_watcher borrow to possibly fix deadlock

This commit is contained in:
2026-05-12 23:37:08 -04:00
parent 09107bc97b
commit 3d2df64ffe
2 changed files with 8 additions and 6 deletions

View File

@@ -234,7 +234,7 @@ impl EventHandler for Handler {
#[tracing::instrument(skip(state))]
pub async fn handle(state: State, interaction: Interaction) {
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 {
Ok((guild_id, voice_channel_id)) => (guild_id, voice_channel_id),
Err(error) => {

View File

@@ -80,11 +80,13 @@ fn get_guild_and_vc_error_to_embed(error: GetGuildAndVoiceChannelIdError) -> Emb
#[tracing::instrument]
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(
state.discord_user_id,
&interaction,
&state.vcs_watcher.borrow(),
);
let user_and_guild_and_voice_channel_id_res = {
get_user_and_guild_and_voice_channel_id(
state.discord_user_id,
&interaction,
&state.vcs_watcher.borrow(),
)
};
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),
Err(error) => {