Fix retries on req body reads
This commit is contained in:
@@ -199,9 +199,16 @@ func (t *TorrentManager) repair(torrent *Torrent) {
|
||||
}
|
||||
|
||||
// second step: download the broken files
|
||||
if len(brokenFiles) > 0 {
|
||||
t.log.Infof("Repairing by downloading only the %d broken out of %d files of torrent %s", len(brokenFiles), torrent.SelectedFiles.Count(), t.GetKey(torrent))
|
||||
|
||||
if len(brokenFiles) == 1 && allBroken {
|
||||
// if all files are broken, we can't do anything
|
||||
t.log.Warnf("Torrent %s has only 1 cached file and it's broken, marking as unfixable", t.GetKey(torrent))
|
||||
t.markAsUnfixable(torrent, "the lone cached file is broken")
|
||||
return
|
||||
|
||||
} else if len(brokenFiles) > 1 {
|
||||
if !allBroken {
|
||||
t.log.Infof("Repairing by downloading only the %d broken out of %d files of torrent %s", len(brokenFiles), torrent.SelectedFiles.Count(), t.GetKey(torrent))
|
||||
redownloadedInfo, err := t.redownloadTorrent(torrent, brokenFileIDs)
|
||||
if err != nil {
|
||||
t.log.Warnf("Cannot repair torrent %s by downloading broken files (error=%s) giving up", t.GetKey(torrent), err.Error())
|
||||
@@ -213,6 +220,8 @@ func (t *TorrentManager) repair(torrent *Torrent) {
|
||||
}
|
||||
}
|
||||
|
||||
t.log.Infof("Repairing by downloading 2 batches of the broken %d files of torrent %s", len(brokenFiles), t.GetKey(torrent))
|
||||
|
||||
// divide the broken files into 2 groups
|
||||
group1 := make([]*File, 0)
|
||||
group2 := make([]*File, 0)
|
||||
|
||||
Reference in New Issue
Block a user