diff --git a/src/s5p/pool.py b/src/s5p/pool.py index 4bffa5d..b50dba5 100644 --- a/src/s5p/pool.py +++ b/src/s5p/pool.py @@ -71,23 +71,15 @@ class ProxyPool: async def start(self) -> None: """Load state, fetch sources, start background loops. - On warm start (state file has alive proxies), the pool begins - serving immediately using cached state and defers all health - testing to background tasks. On cold start, a full health - test runs before returning so the caller has live proxies. + Always defers health testing to background so the server starts + listening immediately. On warm start, cached alive proxies are + available right away. On cold start, proxies become available + as the background test progresses. """ self._load_state() - warm = bool(self._alive_keys) await self._fetch_all_sources() - - if warm: - # trust persisted alive state, verify in background - self._save_state() - self._tasks.append(asyncio.create_task(self._deferred_full_test())) - else: - # cold start: test everything before serving - await self._run_health_tests() - self._save_state() + self._save_state() + self._tasks.append(asyncio.create_task(self._deferred_full_test())) self._tasks.append(asyncio.create_task(self._refresh_loop())) self._tasks.append(asyncio.create_task(self._health_loop()))