Concurrency adjustments again
forgot to add mutex to some critical parts
This commit is contained in:
1 parent
dde0654aa0
commit
9b8d1ead08
1 file changed
+4
@@ -291,10 +291,14 @@ func enqueuePlay(user *discordgo.User, guild *discordgo.Guild, coll *SoundCollec
|
|||||||
|
|
||||||
if exists {
|
if exists {
|
||||||
if len(queues[guild.ID]) < maxQueueSize {
|
if len(queues[guild.ID]) < maxQueueSize {
|
||||||
|
mutex.Lock()
|
||||||
queues[guild.ID] <- play
|
queues[guild.ID] <- play
|
||||||
|
mutex.Unlock()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
mutex.Lock()
|
||||||
queues[guild.ID] = make(chan *Play, maxQueueSize)
|
queues[guild.ID] = make(chan *Play, maxQueueSize)
|
||||||
|
mutex.Unlock()
|
||||||
playSound(play, nil)
|
playSound(play, nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user