docs(fal): describe the shared direct-client cache in fal_common and its tests
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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"]
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user