From b94c5b848fca40d922061e61cf6021a34bd6a156 Mon Sep 17 00:00:00 2001 From: Pedro Fernandes Date: Sat, 17 Jun 2023 22:59:24 +0100 Subject: [PATCH] Infinite lock fix, when have a error not unlock Fixed Error downloading non existing mp3 link --- service/fileService.go | 5 +++-- service/podcastService.go | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/service/fileService.go b/service/fileService.go index 6f9c921..18e2b27 100644 --- a/service/fileService.go +++ b/service/fileService.go @@ -31,12 +31,13 @@ func Download(link string, episodeTitle string, podcastName string, prefix strin req, err := getRequest(link) if err != nil { Logger.Errorw("Error creating request: "+link, err) + return "", err } resp, err := client.Do(req) if err != nil { - Logger.Errorw("Error getting response: "+link, err) - return "", err + // Logger.Errorw("Error getting response: "+link, nil) + return link, nil } fileName := getFileName(link, episodeTitle, ".mp3") diff --git a/service/podcastService.go b/service/podcastService.go index ac91a5e..a557768 100644 --- a/service/podcastService.go +++ b/service/podcastService.go @@ -526,6 +526,7 @@ func DownloadMissingEpisodes() error { fmt.Println("Processing episodes: ", strconv.Itoa(len(*data))) if err != nil { + db.Unlock(JOB_NAME) return err } var wg sync.WaitGroup