mirror of
https://github.com/FunnyWolf/agentic-soc-platform.git
synced 2026-08-22 13:12:56 +02:00
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>
22 lines
626 B
Python
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"])
|