Write listeners statistics for a current song in case of an interrupting signal.
This commit is contained in:
parent
d94c029fda
commit
454df3bb74
@ -112,6 +112,7 @@ func main() {
|
||||
switch <-sysSignal {
|
||||
case os.Interrupt, syscall.SIGINT, syscall.SIGTERM, syscall.SIGABRT, syscall.SIGSEGV:
|
||||
if currentSong.Artist != "" {
|
||||
currentSong.Listeners, currentSong.MaxListeners = lstnrs.Reset()
|
||||
if err := stats.Add(¤tSong); err != nil {
|
||||
log.Println("failed to save a current song during a shutdown:", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user