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:
imSp4rky
2026-11-02 14:40:58 -07:00
parent e01204ac13
commit bb081046e2
23 changed files with 316 additions and 163 deletions
+17
View File
@@ -66,3 +66,20 @@ def test_server_pushes_again_after_one_vault_failed(monkeypatch: pytest.MonkeyPa
handlers.cache_to_vaults({KID.hex: KEY}, "SVC")
handlers.cache_to_vaults({KID.hex: KEY}, "SVC")
assert len(pushes) == 2
def test_one_licence_request_builds_the_server_vaults_once(monkeypatch: pytest.MonkeyPatch) -> None:
builds: list = []
pushes: list = []
def build(name: str) -> Any:
builds.append(name)
return fake_server_vaults(pushes, [FakeVault(False)])
monkeypatch.setattr(handlers, "load_server_vaults", build)
monkeypatch.setattr(handlers, "CACHED_PAIRS", set())
shared: dict = {}
handlers.cache_to_vaults({KID.hex: KEY}, "SVC", shared=shared)
handlers.cache_to_vaults({KID.hex: KEY}, "SVC", shared=shared)
assert len(builds) == 1
assert len(pushes) == 2