smart queue fix

This commit is contained in:
Mateusz Gruszczyński
2026-05-05 15:39:32 +02:00
parent 48bf3ca209
commit 912d89abba

View File

@@ -368,13 +368,14 @@ def _cleanup_auto_labels(client: Any, profile_id: int, torrents: list[dict[str,
def _is_running_download_slot(t: dict[str, Any]) -> bool: def _is_running_download_slot(t: dict[str, Any]) -> bool:
"""Return True only for incomplete torrents that are currently allowed to run.""" """Return True for incomplete torrents that already occupy a Smart Queue slot."""
# Note: Samo state=1 nie wystarcza, bo d.pause w rTorrent zostawia state=1. # Note: Limit Smart Queue oznacza docelową liczbę slotów włączonych do pobierania.
# Poprzednia logika traktowała pauzowane torrenty jako aktywne sloty, przez co Smart Queue # rTorrent często pokazuje d.is_active=0 dla torrentów bez chwilowego transferu, więc slot liczymy
# nie dobijał do targetu i nie wybierał ich jako kandydatów do wznowienia. # po d.state=1. Techniczny label Smart Queue jest wyjątkiem: oznacza pozycję oczekującą/pauzowaną,
# której nie wolno liczyć jako aktywnej. Dzięki temu przy limicie 100 i 82 slotach dobieramy 18.
if int(t.get('complete') or 0): if int(t.get('complete') or 0):
return False return False
if bool(t.get('paused')) or str(t.get('status') or '').lower() == 'paused': if str(t.get('label') or '') == SMART_QUEUE_LABEL:
return False return False
if str(t.get('status') or '').lower() == 'checking': if str(t.get('status') or '').lower() == 'checking':
return False return False