Delete if everything is unselected
This commit is contained in:
@@ -535,16 +535,24 @@ func (t *TorrentManager) repairAll() {
|
||||
return
|
||||
}
|
||||
forRepair := false
|
||||
unselected := 0
|
||||
torrent.SelectedFiles.IterCb(func(_ string, file *File) {
|
||||
if file.Link == "@" || file.ForRepair {
|
||||
if file.Link == "repair" {
|
||||
t.log.Debugf("Found a file to repair for torrent %s", torrent.AccessKey)
|
||||
forRepair = true
|
||||
}
|
||||
if file.Link == "unselect" {
|
||||
unselected++
|
||||
}
|
||||
})
|
||||
if forRepair {
|
||||
t.log.Infof("Repairing %s", torrent.AccessKey)
|
||||
t.Repair(torrent.AccessKey)
|
||||
}
|
||||
if unselected == torrent.SelectedFiles.Count() && unselected > 0 {
|
||||
t.log.Infof("Deleting %s", torrent.AccessKey)
|
||||
t.Delete(torrent.AccessKey)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -756,14 +764,17 @@ func (t *TorrentManager) canCapacityHandle() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
if retryCount >= maxRetries {
|
||||
t.log.Error("Max retries reached, exiting")
|
||||
return false
|
||||
}
|
||||
delay := time.Duration(math.Pow(2, float64(retryCount))) * baseDelay
|
||||
if delay > maxDelay {
|
||||
delay = maxDelay
|
||||
}
|
||||
t.log.Infof("We have reached the max number of active torrents, waiting for %s seconds before retrying", delay)
|
||||
|
||||
if retryCount >= maxRetries {
|
||||
t.log.Error("Max retries reached, exiting")
|
||||
return false
|
||||
}
|
||||
|
||||
time.Sleep(delay)
|
||||
retryCount++
|
||||
}
|
||||
|
||||
@@ -24,8 +24,7 @@ func (t *Torrent) InProgress() bool {
|
||||
|
||||
type File struct {
|
||||
realdebrid.File
|
||||
Added string
|
||||
Link string
|
||||
ZurgFS uint64
|
||||
ForRepair bool
|
||||
Added string
|
||||
Link string
|
||||
ZurgFS uint64
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user