Clear download and unrestrict maps
This commit is contained in:
@@ -381,6 +381,10 @@ func (t *TorrentManager) mountNewDownloads() {
|
||||
token := t.Config.GetToken()
|
||||
tokenMap, _ := t.rd.UnrestrictMap.Get(token)
|
||||
|
||||
// clear maps
|
||||
tokenMap.Clear()
|
||||
t.DownloadMap.Clear()
|
||||
|
||||
downloads := t.rd.GetDownloads()
|
||||
mountedCount := 0
|
||||
for i := range downloads {
|
||||
@@ -426,10 +430,8 @@ func (t *TorrentManager) StartDownloadsJob() {
|
||||
for {
|
||||
select {
|
||||
case <-remountTicker.C:
|
||||
t.DownloadMap.Clear()
|
||||
t.mountNewDownloads()
|
||||
case <-t.RemountTrigger:
|
||||
t.DownloadMap.Clear()
|
||||
t.mountNewDownloads()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,8 +82,6 @@ func (rd *RealDebrid) UnrestrictAndVerify(link string) (*Download, error) {
|
||||
if utils.IsBytesLimitReached(err) {
|
||||
rd.TokenManager.SetTokenAsExpired(token, "bandwidth limit exceeded")
|
||||
continue
|
||||
} else if utils.IsInvalidDownloadCode(err) {
|
||||
continue
|
||||
} else if err == nil {
|
||||
rd.verifiedLinks.Set(download.ID, time.Now().Unix()+DOWNLOAD_LINK_EXPIRY)
|
||||
return download, nil
|
||||
@@ -103,8 +101,6 @@ func (rd *RealDebrid) UnrestrictAndVerify(link string) (*Download, error) {
|
||||
if utils.IsBytesLimitReached(err) {
|
||||
rd.TokenManager.SetTokenAsExpired(token, "bandwidth limit exceeded")
|
||||
continue
|
||||
} else if utils.IsInvalidDownloadCode(err) {
|
||||
continue
|
||||
} else if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user