feat: stabilize multi-region runtime sync and worker orchestration

This commit is contained in:
root
2026-04-27 15:48:12 +08:00
parent 7cbde2aa78
commit 215a364891
137 changed files with 31931 additions and 1943 deletions

View File

@@ -7,6 +7,9 @@ from domainCheck.detect import register
class RegisterTimeoutConfigTests(unittest.TestCase):
def tearDown(self):
register._PROXY_MANAGERS.clear()
def test_proxy_timeout_uses_bounded_total(self):
with patch.dict("os.environ", {}, clear=False):
timeout = register._resolve_register_timeout({"http": "http://127.0.0.1:8080"})
@@ -59,6 +62,19 @@ class RegisterTimeoutConfigTests(unittest.TestCase):
allow_redirects=True,
)
def test_proxy_manager_cache_evicts_oldest_entry(self):
with patch.dict("os.environ", {"DOMAINCHECK_REGISTER_PROXY_SESSION_CACHE_SIZE": "2"}, clear=False):
first = register._get_http_manager({"http": "http://127.0.0.1:8080"})
second = register._get_http_manager({"http": "http://127.0.0.1:8081"})
third = register._get_http_manager({"http": "http://127.0.0.1:8082"})
self.assertEqual(2, len(register._PROXY_MANAGERS))
self.assertIsNotNone(second)
self.assertIsNotNone(third)
recreated_first = register._get_http_manager({"http": "http://127.0.0.1:8080"})
self.assertIsNot(first, recreated_first)
if __name__ == "__main__":
unittest.main()