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

@@ -61,7 +61,7 @@ func (dl *Downloader) DownloadFile(
return
}
unrestrict := torMgr.UnrestrictFileUntilOk(file, cfg.ShouldServeFromRclone())
unrestrict := torMgr.UnrestrictFile(file, cfg.ShouldServeFromRclone())
if unrestrict == nil {
log.Warnf("File %s cannot be unrestricted (link=%s)", fileName, file.Link)
if err := file.State.Event(context.Background(), "break_file"); err != nil {
@@ -104,7 +104,7 @@ func (dl *Downloader) DownloadLink(
log *logutil.Logger,
) {
// log.Debugf("Opening file %s (%s)", fileName, link)
unrestrict := torMgr.UnrestrictLinkUntilOk(link, cfg.ShouldServeFromRclone())
unrestrict := torMgr.UnrestrictLink(link, cfg.ShouldServeFromRclone())
if unrestrict == nil {
log.Warnf("File %s cannot be unrestricted (link=%s)", fileName, link)
http.Error(resp, "File is not available", http.StatusInternalServerError)