Return an error for 503

This commit is contained in:
Ben Adrian Sarmiento
2024-06-23 22:08:54 +02:00
parent 8bf39d58de
commit 3abf48514d
10 changed files with 87 additions and 65 deletions

View File

@@ -189,12 +189,12 @@ func (t *TorrentManager) repair(torrent *Torrent, wg *sync.WaitGroup) {
return
}
// check for other broken files
// check for other broken file
torrent.SelectedFiles.IterCb(func(_ string, file *File) {
if !file.State.Is("ok_file") {
return
}
if t.UnrestrictFileUntilOk(file, true) == nil {
if t.UnrestrictFile(file, true) == nil {
file.State.Event(context.Background(), "break_file")
}
})
@@ -324,7 +324,7 @@ func (t *TorrentManager) assignLinks(torrent *Torrent) bool {
torrent.UnassignedLinks.Clone().Each(func(link string) bool {
// unrestrict each unassigned link that was filled out during torrent init
unrestrict := t.UnrestrictLinkUntilOk(link, true)
unrestrict := t.UnrestrictLink(link, true)
if unrestrict == nil {
expiredCount++
return false // next unassigned link
@@ -653,7 +653,7 @@ func (t *TorrentManager) isStillBroken(info *realdebrid.TorrentInfo, brokenFiles
// check if the broken files can now be unrestricted and downloaded
for _, oldFile := range brokenFiles {
for idx, newFile := range selectedFiles {
if oldFile.ID == newFile.ID && t.UnrestrictFileUntilOk(selectedFiles[idx], true) == nil {
if oldFile.ID == newFile.ID && t.UnrestrictFile(selectedFiles[idx], true) == nil {
return true
}
}