fix: mutex lock
This commit is contained in:
parent
e79b4142de
commit
fc32017a10
1 changed files with 4 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue