chages in smart queue
This commit is contained in:
@@ -977,13 +977,37 @@ def _refill_underfilled_queue(profile: dict, settings: dict[str, Any], profile_i
|
||||
| {str(t.get('hash') or '') for t in stopped if _has_smart_queue_label(str(t.get('label') or '')) and str(t.get('hash') or '') not in set(started_by_queue)}
|
||||
)
|
||||
restored = _cleanup_auto_labels(c, profile_id, torrents, keep_labels, True)
|
||||
# Note: Cooldown refill uses started incomplete torrents as queue slots. This diagnostic
|
||||
# explains why a refill may legitimately start nothing even when only a few torrents transfer data.
|
||||
active_transferring = sum(1 for t in downloading if int(t.get('down_rate') or 0) > 0 or int(t.get('up_rate') or 0) > 0)
|
||||
active_rtorrent = sum(1 for t in downloading if int(t.get('active') or 0))
|
||||
active_state = sum(1 for t in downloading if int(t.get('state') or 0))
|
||||
active_after_expected = len(downloading) + len(start_requested)
|
||||
if available_slots <= 0:
|
||||
refill_decision = f'Cooldown refill skipped: active slots at limit ({len(downloading)}/{max_active})'
|
||||
refill_blocked_reason = 'active_slots_at_limit'
|
||||
elif not candidates:
|
||||
refill_decision = 'Cooldown refill skipped: no stopped candidates available'
|
||||
refill_blocked_reason = 'no_candidates'
|
||||
elif start_requested:
|
||||
refill_decision = f'Cooldown refill requested {len(start_requested)} start(s)'
|
||||
refill_blocked_reason = ''
|
||||
else:
|
||||
refill_decision = 'Cooldown refill ran but rTorrent did not confirm new starts yet'
|
||||
refill_blocked_reason = 'start_not_confirmed'
|
||||
details = {
|
||||
'decision': refill_decision,
|
||||
'blocked_reason': refill_blocked_reason,
|
||||
'enabled': bool(settings.get('enabled')),
|
||||
'cooldown_refill': True,
|
||||
'cooldown_respected': True,
|
||||
'refill_mode': _refill_mode(settings),
|
||||
'refill_interval_minutes': int(settings.get('refill_interval_minutes') or 0),
|
||||
'active_before': len(downloading),
|
||||
'active_after_expected': active_after_expected,
|
||||
'active_transferring_count': active_transferring,
|
||||
'active_rtorrent_count': active_rtorrent,
|
||||
'active_state_count': active_state,
|
||||
'available_slots': available_slots,
|
||||
'candidates': len(candidates),
|
||||
'start_source_skipped': len(source_skipped),
|
||||
@@ -1014,6 +1038,10 @@ def _refill_underfilled_queue(profile: dict, settings: dict[str, Any], profile_i
|
||||
'max_active_downloads': max_active,
|
||||
'available_slots': available_slots,
|
||||
'candidates': len(candidates),
|
||||
'active_transferring': active_transferring,
|
||||
'active_rtorrent': active_rtorrent,
|
||||
'active_state': active_state,
|
||||
'blocked_reason': refill_blocked_reason,
|
||||
'start_source_skipped': len(source_skipped),
|
||||
'requested': len(start_requested),
|
||||
'verified': len(active_verified),
|
||||
@@ -1069,7 +1097,11 @@ def _refill_underfilled_queue(profile: dict, settings: dict[str, Any], profile_i
|
||||
'start_pending_confirmation': start_pending_confirmation,
|
||||
'active_verified': active_verified,
|
||||
'active_before': len(downloading),
|
||||
'active_after_expected': len(downloading) + len(started_by_queue),
|
||||
'active_after_expected': active_after_expected,
|
||||
'active_transferring_count': active_transferring,
|
||||
'active_rtorrent_count': active_rtorrent,
|
||||
'active_state_count': active_state,
|
||||
'blocked_reason': refill_blocked_reason,
|
||||
'available_slots': available_slots,
|
||||
'start_source_skipped': len(source_skipped),
|
||||
'checked': len(torrents),
|
||||
|
||||
Reference in New Issue
Block a user