Fixed deadlock caused by misunderstanding of how defer works.
This commit is contained in:
parent
21995ea4cd
commit
1ed81fdd36
@ -152,11 +152,11 @@ func IcecastWatchPlaylist(playlistPath string, lastNSongs int) error {
|
|||||||
select {
|
select {
|
||||||
case <-playlistFired:
|
case <-playlistFired:
|
||||||
lastPlayedCacheMutex.Lock()
|
lastPlayedCacheMutex.Lock()
|
||||||
defer lastPlayedCacheMutex.Unlock()
|
|
||||||
songs, err := lastPlayedSongs(lastNSongs, playlistPath)
|
songs, err := lastPlayedSongs(lastNSongs, playlistPath)
|
||||||
if err == nil && len(songs) > 0 {
|
if err == nil && len(songs) > 0 {
|
||||||
lastPlayedCache = songs
|
lastPlayedCache = songs
|
||||||
}
|
}
|
||||||
|
lastPlayedCacheMutex.Unlock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Loading…
Reference in New Issue
Block a user