Fix possible issues
This commit is contained in:
@@ -87,7 +87,9 @@ func (t *TorrentManager) refreshTorrents() []string {
|
||||
})
|
||||
|
||||
if t.Config.EnableRepair() {
|
||||
t.handleFixers()
|
||||
t.workerPool.Submit(func() {
|
||||
t.handleFixers()
|
||||
})
|
||||
}
|
||||
|
||||
return updatedPaths
|
||||
@@ -104,11 +106,11 @@ func (t *TorrentManager) StartRefreshJob() {
|
||||
select {
|
||||
case <-refreshTicker.C:
|
||||
checksum := t.getCurrentState()
|
||||
if t.latestState.equal(checksum) {
|
||||
if t.latestState.Eq(checksum) {
|
||||
continue
|
||||
}
|
||||
t.SetNewLatestState(checksum)
|
||||
t.log.Infof("Detected changes! Refreshing %d torrents", checksum.TotalCount)
|
||||
t.setNewLatestState(checksum)
|
||||
|
||||
updatedPaths := t.refreshTorrents()
|
||||
t.log.Info("Finished refreshing torrents")
|
||||
@@ -175,15 +177,17 @@ func (t *TorrentManager) getMoreInfo(rdTorrent realdebrid.Torrent) *Torrent {
|
||||
continue
|
||||
}
|
||||
selectedFiles = append(selectedFiles, &File{
|
||||
File: file,
|
||||
Ended: info.Ended,
|
||||
Link: "", // no link yet
|
||||
File: file,
|
||||
Ended: info.Ended,
|
||||
Link: "", // no link yet
|
||||
IsBroken: true,
|
||||
})
|
||||
}
|
||||
if len(selectedFiles) == len(info.Links) {
|
||||
// all links are still intact! good!
|
||||
for i, file := range selectedFiles {
|
||||
file.Link = info.Links[i]
|
||||
file.IsBroken = false
|
||||
}
|
||||
torrent.UnassignedLinks = mapset.NewSet[string]()
|
||||
} else {
|
||||
@@ -278,7 +282,7 @@ func (t *TorrentManager) mergeToMain(existing, toMerge *Torrent) Torrent {
|
||||
// 1. https://*** - the file is available
|
||||
// 3. empty - the file is not available
|
||||
mainTorrent.SelectedFiles.IterCb(func(key string, file *File) {
|
||||
if file.Link == "" {
|
||||
if file.IsBroken {
|
||||
file, ok := older.SelectedFiles.Get(key)
|
||||
if ok {
|
||||
mainTorrent.SelectedFiles.Set(key, file)
|
||||
|
||||
Reference in New Issue
Block a user