fix subscription stale download dedup

This commit is contained in:
ShukeBta
2026-06-26 17:05:31 +08:00
parent 0e11d64a2f
commit a587054443
8 changed files with 235 additions and 6 deletions
@@ -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