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