SIGN IN SIGN UP

test: replace fixed sleep with poll_until_condition in test_cache_initialization (#882)

## Summary

Fixes flakiness in `test_cache_initialization` (integration tests, see
[run
25099976014](https://github.com/apify/apify-sdk-python/actions/runs/25099976014)).

The test used fixed `asyncio.sleep(10)` waits to give Apify platform
stats time to propagate. In CI, 10s wasn't always enough — `read_count`
was still `0` after the second sleep, so the assertion failed even
though the cache had been initialized correctly.

Switched to the existing `poll_until_condition` helper (already used
elsewhere in this file for the same purpose). It calls `get_metadata`
immediately, then polls every 5s up to a 60s timeout — faster in the
happy path, more tolerant of platform lag in the slow path. Real
regressions still fail the test; only the propagation-timing flake is
masked.
V
Vlada Dusek committed
c522b1a20820831443712d7f49dce94e0ec69f99
Parent: a57fcd3
Committed by GitHub <noreply@github.com> on 4/29/2026, 2:42:51 PM