From dd46eebb877892a061184d09c0d9cfb6c28b8360 Mon Sep 17 00:00:00 2001 From: Sushant Gautam Date: Wed, 11 Nov 2026 20:12:19 +0100 Subject: [PATCH] fix: disable the Agent-page sync throttle under both test runners The PyPI publish workflow runs manage.py test, which skips conftest.py, so the per-process throttle handed one test another test's cached sync (ids are reused across test cases). Settings now turn it off whenever the test suite runs, unless SIMPLEAUDIT_OPENWEBUI_SYNC_TTL_S is set explicitly. --- config/settings.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/settings.py b/config/settings.py index c10ef09f..078ffc6c 100644 --- a/config/settings.py +++ b/config/settings.py @@ -374,6 +374,11 @@ def _csrf_trusted_origins() -> list[str]: or bool(os.environ.get("PYTEST_CURRENT_TEST")) or env_bool("SIMPLEAUDIT_TESTING", False) ) +if _TESTING and "SIMPLEAUDIT_OPENWEBUI_SYNC_TTL_S" not in os.environ: + # Tests reuse workspace/user ids across cases, so a per-process sync + # throttle would hand one test another test's cached sync. Both runners + # (pytest and manage.py test) go through here. + OPENWEBUI_SYNC_TTL_S = 0.0 if not (DEBUG or MINIMAL_CONFIG or DEMO_MODE or _TESTING): # TLS termination and the HTTP→HTTPS redirect are owned by the reverse # proxy (Cloudflare / nginx / Caddy). Django trusts the proxy via