Files
funnywolfandCopilot 16854d0c45 Fix worker config refresh and frontend healthcheck
Refresh runtime configuration before worker iterations so long-running worker processes do not keep stale lru_cache values after settings changes. Also probe the frontend healthcheck through 127.0.0.1 to match the nginx listener.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-28 22:24:01 +08:00

22 lines
626 B
Python

from unittest.mock import patch
from django.test import SimpleTestCase
from apps.common.worker_runner import _run_once_or_raise
class WorkerRunnerTests(SimpleTestCase):
def test_run_once_refreshes_runtime_config_before_work(self):
calls = []
def run_once():
calls.append("run_once")
return True
with patch("apps.common.worker_runner._refresh_runtime_config_cache") as refresh:
result = _run_once_or_raise("test worker", run_once)
self.assertTrue(result.processed)
refresh.assert_called_once()
self.assertEqual(calls, ["run_once"])