new functions

This commit is contained in:
Mateusz Gruszczyński
2026-05-05 08:00:32 +02:00
parent 4b236c21f8
commit fa0d2f13fe
8 changed files with 304 additions and 6 deletions

View File

@@ -6,7 +6,7 @@ from ..config import POLL_INTERVAL
from .preferences import active_profile, get_profile
from .torrent_cache import torrent_cache
from .torrent_summary import cached_summary
from . import rtorrent, smart_queue, traffic_history, automation_rules
from . import rtorrent, smart_queue, traffic_history, automation_rules, torrent_stats
_started = False
@@ -43,6 +43,9 @@ def register_socketio_handlers(socketio):
heartbeat["ok"] = False
heartbeat["error"] = str(exc)
socketio.emit("rtorrent_error", {"profile_id": profile["id"], "error": str(exc)})
if tick % max(1, int(15 * 60 / POLL_INTERVAL)) == 0:
# Note: Torrent statistics are refreshed in the background every 15 minutes after startup delay.
torrent_stats.maybe_refresh(profile, force=False)
if tick % max(1, int(30 / POLL_INTERVAL)) == 0:
try:
result = smart_queue.check(profile, force=False)