mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-06 05:16:38 +08:00
fix subscription stale download dedup
This commit is contained in:
@@ -71,6 +71,9 @@ func (s *SubscriptionService) addDownloadTaskAvailability(ctx context.Context, s
|
||||
if !downloadTaskBlocksReadd(row.Status) {
|
||||
continue
|
||||
}
|
||||
if !s.downloadTaskCountsAsPending(ctx, row) {
|
||||
continue
|
||||
}
|
||||
linkedToSubscription := sub != nil && strings.TrimSpace(row.SubscriptionID) != "" && row.SubscriptionID == sub.ID
|
||||
if !linkedToSubscription && baseSavePath != "" && row.SavePath != "" && !sameOrChildPath(row.SavePath, baseSavePath) && !sameOrChildPath(baseSavePath, row.SavePath) {
|
||||
continue
|
||||
@@ -83,6 +86,13 @@ func (s *SubscriptionService) addDownloadTaskAvailability(ctx context.Context, s
|
||||
}
|
||||
}
|
||||
|
||||
func (s *SubscriptionService) downloadTaskCountsAsPending(ctx context.Context, row model.DownloadTask) bool {
|
||||
if s == nil || s.downloads == nil {
|
||||
return true
|
||||
}
|
||||
return s.downloads.subscriptionDownloadTaskStillLive(ctx, row)
|
||||
}
|
||||
|
||||
func (s *SubscriptionService) addLiveTorrentAvailability(ctx context.Context, query string, out *LocalAvailability) {
|
||||
if s == nil || s.downloads == nil || s.downloads.qb == nil || out == nil {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user