multilang_and_other #8
@@ -287,6 +287,20 @@ def _emit_torrent_refresh(profile: dict, action_name: str) -> None:
|
||||
_emit("rtorrent_error", {"profile_id": int(profile.get("id") or 0), "error": str(exc)})
|
||||
|
||||
|
||||
def _schedule_delayed_torrent_refresh(profile: dict, action_name: str) -> None:
|
||||
if action_name not in {"start", "stop", "pause", "resume", "unpause"} or not _socketio:
|
||||
return
|
||||
|
||||
def delayed_refresh():
|
||||
# Note: rTorrent may expose state changes one poll later than the XML-RPC action result.
|
||||
sleep_fn = getattr(_socketio, "sleep", time.sleep)
|
||||
for delay in (0.75, 1.75):
|
||||
sleep_fn(delay)
|
||||
_emit_torrent_refresh(profile, action_name)
|
||||
|
||||
_socketio.start_background_task(delayed_refresh)
|
||||
|
||||
|
||||
def _run(job_id: str):
|
||||
if not _claim_runner(job_id):
|
||||
return
|
||||
@@ -333,7 +347,9 @@ def _run(job_id: str):
|
||||
operation_logs.record_job_event(profile["id"], job["action"], "done", payload, result=result or {}, job_id=job_id, user_id=int(job.get("user_id") or 0))
|
||||
_emit("operation_finished", {"job_id": job_id, "action": job["action"], "profile_id": profile["id"], "hashes": payload.get("hashes") or [], "hash_count": len(payload.get("hashes") or []), "bulk": len(payload.get("hashes") or []) > 1, "result": result, **event_meta})
|
||||
# Note: Completed jobs must publish a fresh torrent snapshot/patch so removed or moved torrents disappear without a page reload.
|
||||
_emit_torrent_refresh(profile, str(job["action"] or ""))
|
||||
action_name = str(job["action"] or "")
|
||||
_emit_torrent_refresh(profile, action_name)
|
||||
_schedule_delayed_torrent_refresh(profile, action_name)
|
||||
_emit("job_update", {"id": job_id, "profile_id": profile["id"], "status": "done", "result": result})
|
||||
except Exception as exc:
|
||||
fresh = _job_row(job_id) or {}
|
||||
|
||||
2
pytorrent/static/js/bootstrap.js
vendored
2
pytorrent/static/js/bootstrap.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user