mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-14 13:05:09 +00:00
perf: lazy-load services and proxy catalogues, faster namespace strip
load_xml strips namespaces without QName; services import on first use and proxy providers fetch their catalogue on first query; the font scan is skipped when no subtitle names a font and is cached per process. Serve CPU -40% and track requests -28% on 20 MB manifests; CLI startup 2.7 s -> 1.2 s; --list 27-46% faster across six services tested.
This commit is contained in:
@@ -1069,8 +1069,10 @@ The returned proxy is HTTPS on **port 443**.
|
||||
methods:
|
||||
|
||||
- `__init__(self, **kwargs)` receives its `proxy_providers` sub-dict splatted as
|
||||
keyword arguments, so YAML keys map 1:1 to constructor parameters. Do authentication
|
||||
and catalogue pre-fetching here.
|
||||
keyword arguments, so YAML keys map 1:1 to constructor parameters. Check the
|
||||
configuration here, but make no request: every `dl` run builds every configured
|
||||
proxy provider, even for a run with no proxy. Read the server or location catalogue
|
||||
through a `functools.cached_property`, so the first query fetches it.
|
||||
- `__repr__(self)` is a human summary, conventionally `"{n} Countries ({m} Servers)"`.
|
||||
- `get_proxy(self, query)` returns a Requests-compatible proxy URI, or `None` only
|
||||
when the query was valid but no proxy exists. Raise on genuine errors or bad queries.
|
||||
|
||||
Reference in New Issue
Block a user