Concurrency adjustments again

forgot to add mutex to some critical parts
This commit is contained in:
da
2017-01-19 14:19:33 +01:00
parent dde0654aa0
commit 9b8d1ead08
+4
View File
@@ -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)
} }
} }