From acd0087ddf2bec298ef9dc4c4f35c9ade53964f6 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Mon, 13 Mar 2023 02:20:57 +0400 Subject: [PATCH] Oh, if http server stop fail, then most listened song will not be saved. Fix that. --- cmd/dwelling-radio/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/dwelling-radio/main.go b/cmd/dwelling-radio/main.go index 24a3b89..db0fe87 100644 --- a/cmd/dwelling-radio/main.go +++ b/cmd/dwelling-radio/main.go @@ -86,9 +86,9 @@ func main() { <-doneSignal + os.WriteFile(config.MostListenedSongPath, radio.StoreMostListenedSong(), fs.ModePerm) + if err := srv.Stop(); err != nil { log.Fatalln(err) } - - os.WriteFile(config.MostListenedSongPath, radio.StoreMostListenedSong(), fs.ModePerm) }