fix: mutex lock

This commit is contained in:
Miguel da Mota 2024-03-10 16:19:19 +01:00
parent e79b4142de
commit fc32017a10

View file

@ -38,7 +38,9 @@ lazy_static! {
}
pub async fn get_queue(guild_id: &GuildId) -> MusicQueue {
match HASHMAP.lock().await.get(&guild_id) {
let mut queues = HASHMAP.lock().await;
match queues.get(&guild_id) {
Some(music_queue) => music_queue.clone(),
None => {
let q = MusicQueue {
@ -46,7 +48,7 @@ pub async fn get_queue(guild_id: &GuildId) -> MusicQueue {
queue: Vec::new(),
now_playing: None,
};
HASHMAP.lock().await.insert(*guild_id, q.clone());
queues.insert(*guild_id, q.clone());
q
}
}