mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-14 21:15:06 +00:00
perf(api): stop rebuilding proxy catalogues, vaults and cdms per request
Cache proxy provider catalogues (10 min), reuse vaults and CDMs across one batch licence call, and cache the health update check, /api/services entries and parsed service config.yaml.
This commit is contained in:
@@ -11,6 +11,7 @@ import pytest
|
||||
|
||||
from unshackle.core import binaries
|
||||
from unshackle.core.config import config
|
||||
from unshackle.core.proxies.proxy import CATALOGUES
|
||||
from unshackle.core.update_checker import UpdateChecker
|
||||
|
||||
# shutdown() blocks until the serve loop polls again, and the 0.5s default is paid by every
|
||||
@@ -40,6 +41,12 @@ def no_update_check(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.setattr(UpdateChecker, "check_for_updates_sync", lambda *args, **kwargs: None)
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def fresh_proxy_catalogues() -> None:
|
||||
"""Fetch each proxy provider catalogue again, so one test's stub never answers another test."""
|
||||
CATALOGUES.clear()
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def default_muxing(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""Mux with the default options, whatever the muxing block of the local unshackle.yaml sets."""
|
||||
|
||||
Reference in New Issue
Block a user