JBrowser Source Docs

jbrowser.core.workers

Generated from the source code of JBrowser 1.5.4.

jbrowser/core/workers.py · 59 lines

Background download helpers shared by the tracker-list and threat-list updaters.

Qt aborts the whole process if a QThread object is destroyed while its thread is still running, so downloads are cancellable (streamed in chunks, short timeouts) and stop_worker makes sure a worker can never be destroyed mid-flight during shutdown.

Constants#

Name Value
MAX_LIST_BYTES 64 * 1024 * 1024

Functions#

fetch_text#

fetch_text(url: str, headers: dict, proxies: dict | None, cancelled: Callable[[], bool]) -> strsource

Download url as text, giving up quickly when cancelled() turns true.

stop_worker#

stop_worker(worker: QThread | None, timeout_ms: int=2000) -> Nonesource

Cancel worker and wait briefly; if it is still busy, detach it so it is never destroyed.