Remove from ongoing downloads even if failed
This commit is contained in:
@@ -23,6 +23,11 @@ func DownloadR(url string) error {
|
||||
ongoingDownloadsMutex.Lock()
|
||||
ongoingDownloads[url] = struct{}{}
|
||||
ongoingDownloadsMutex.Unlock()
|
||||
defer func() {
|
||||
ongoingDownloadsMutex.Lock()
|
||||
delete(ongoingDownloads, url)
|
||||
ongoingDownloadsMutex.Unlock()
|
||||
}()
|
||||
|
||||
log.Printf("Downloading %s", url)
|
||||
|
||||
@@ -76,9 +81,6 @@ func DownloadR(url string) error {
|
||||
}
|
||||
|
||||
log.Printf("Downloaded %s", url)
|
||||
ongoingDownloadsMutex.Lock()
|
||||
delete(ongoingDownloads, url)
|
||||
ongoingDownloadsMutex.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user