light poller commit3

This commit is contained in:
Mateusz Gruszczyński
2026-05-27 15:13:22 +02:00
parent 054c9122f8
commit a8adee0f2f
6 changed files with 143 additions and 4 deletions

View File

@@ -148,12 +148,14 @@ def register_socketio_handlers(socketio):
speed_status = _speed_status_from_rows(pid, rows)
if run_live:
live_started = time.monotonic()
live = torrent_cache.refresh_live(profile)
rtorrent_call_count += 1
state.last_live_at = now
state.last_fast_at = now
ok = bool(live.get("ok"))
error = str(live.get("error") or "")
poller_control.mark_live_poll(state, live_started, ok, error, len(live.get("updated") or []), bool(live.get("requires_full_refresh")))
rows = torrent_cache.snapshot(pid)
active = _is_active_rows(rows)
speed_status = _speed_status_from_rows(pid, rows) if live.get("ok") else speed_status
@@ -179,11 +181,13 @@ def register_socketio_handlers(socketio):
_emit_profile(socketio, "rtorrent_error", live, pid)
if run_list:
list_started = time.monotonic()
diff = torrent_cache.refresh(profile)
rtorrent_call_count += 1
state.last_list_at = now
ok = bool(diff.get("ok"))
error = str(diff.get("error") or "")
poller_control.mark_list_poll(state, list_started, ok, error, len(diff.get("added") or []), len(diff.get("updated") or []), len(diff.get("removed") or []))
rows = torrent_cache.snapshot(pid)
active = _is_active_rows(rows)
speed_status = _speed_status_from_rows(pid, rows) if diff.get("ok") else speed_status