docs(fal): describe the shared direct-client cache in fal_common and its tests

This commit is contained in:
kshitijk4poor
2026-11-14 14:57:25 +05:30
committed by kshitij
parent ab7b3ad806
commit 802b57261c
3 changed files with 9 additions and 5 deletions

View File

@@ -203,7 +203,7 @@ class TestFamilyRouting:
@pytest.fixture
def with_fake_fal(self, monkeypatch):
"""Stub fal_client.submit to capture which endpoint we hit."""
"""Stub fal_client.SyncClient(key=...).submit to capture which endpoint we hit."""
import sys
import types
@@ -548,7 +548,7 @@ class TestUpscalePass:
@pytest.fixture
def with_fake_fal(self, monkeypatch):
"""Stub fal_client.submit, capturing every endpoint hit in order."""
"""Stub fal_client.SyncClient(key=...).submit, capturing every endpoint hit in order."""
import sys
import types

View File

@@ -76,7 +76,7 @@ def test_routed_turns_sign_with_their_own_profile_key(two_profiles, monkeypatch,
assert submit(module, monkeypatch) == "handle"
assert signed == ["B", "A", "B"]
# One client per key, reused across turns rather than rebuilt (and leaked) per request.
# One client per profile, reused across turns rather than rebuilt (and leaked) per request.
assert constructed == ["B", "A"]

View File

@@ -11,9 +11,13 @@ Holds the stateless atoms that every FAL-backed tool needs:
* :func:`_normalize_fal_queue_url_format`, :func:`_extract_http_status`
— small helpers used by both the managed client wrapper and
``_submit_fal_request``.
* :func:`direct_fal_client` — the direct-key ``SyncClient`` for the active
profile, shared by the image tool and the video plugin. Its per-profile
cache lives here; it is keyed on the ``fal_client`` module the caller
passes in, so a test that replaces that module still gets a fresh client.
Stateful pieces (cache globals, ``_managed_fal_client*`` selectors,
``_submit_fal_request``) intentionally stay on
The managed-client stateful pieces (``_managed_fal_client*`` cache globals and
selectors, ``_submit_fal_request``) intentionally stay on
:mod:`tools.image_generation_tool`. That module is the patch target for
existing test suites (``tests/tools/test_image_generation.py``,
``tests/tools/test_managed_media_gateways.py``) and for the