Clone set before modifying
This commit is contained in:
@@ -15,7 +15,12 @@ import (
|
||||
cmap "github.com/orcaman/concurrent-map/v2"
|
||||
)
|
||||
|
||||
func inProgressStatus(status string) bool {
|
||||
return status == "downloading" || status == "uploading" || status == "queued" || status == "compressing"
|
||||
}
|
||||
|
||||
func (t *TorrentManager) refreshTorrents() []string {
|
||||
t.inProgressHashes = mapset.NewSet[string]()
|
||||
instances, _, err := t.api.GetTorrents(false)
|
||||
if err != nil {
|
||||
t.log.Warnf("Cannot get torrents: %v", err)
|
||||
@@ -40,6 +45,9 @@ func (t *TorrentManager) refreshTorrents() []string {
|
||||
if t.binImmediately(instances[idx].ID) ||
|
||||
t.binOnceDoneErrorCheck(instances[idx].ID, instances[idx].Status) ||
|
||||
instances[idx].Progress != 100 {
|
||||
if inProgressStatus(instances[idx].Status) {
|
||||
t.inProgressHashes.Add(instances[idx].Hash)
|
||||
}
|
||||
mergeChan <- nil
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user