Skip to content

Commit 87da1c2

Browse files
vdusekclaude
andauthored
test: extend retry window for synthetic PPE event propagation (#865)
## Summary - Increased `retry_counter(30)` to `retry_counter(120)` in `test_actor_push_data_charges_both_events` and `test_actor_push_data_combined_budget_limit` - Synthetic events like `apify-default-dataset-item` are computed by the platform from dataset writes asynchronously — unlike explicit charges (which hit the charge endpoint directly and reflect immediately), these take longer to propagate into `charged_event_counts` - The existing 30-second window was insufficient; 2 minutes gives the platform enough time **Failed CI run that triggered this fix:** - https://github.com/apify/apify-sdk-python/actions/runs/24509008169/job/71634833762?pr=863 --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent bd7a715 commit 87da1c2

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

tests/e2e/test_actor_charge.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,10 @@ async def test_actor_push_data_charges_both_events(
171171
"""Test that push_data charges both the explicit event and the synthetic apify-default-dataset-item event."""
172172
run = await run_actor(ppe_push_data_actor)
173173

174-
# Refetch until the platform gets its act together
175-
for is_last_attempt, _ in retry_counter(30):
174+
# Use a longer retry window (120 attempts x 1 s) for synthetic events like `apify-default-dataset-item`:
175+
# the platform computes them from dataset writes asynchronously, so they propagate more slowly than
176+
# explicit charges (which are reflected immediately via the charge endpoint).
177+
for is_last_attempt, _ in retry_counter(120):
176178
await asyncio.sleep(1)
177179
updated_run = await apify_client_async.run(run.id).get()
178180
run = ActorRun.model_validate(updated_run)
@@ -200,8 +202,10 @@ async def test_actor_push_data_combined_budget_limit(
200202
"""
201203
run = await run_actor(ppe_push_data_actor, max_total_charge_usd=Decimal('0.20'))
202204

203-
# Refetch until the platform gets its act together
204-
for is_last_attempt, _ in retry_counter(30):
205+
# Use a longer retry window (120 attempts x 1 s) for synthetic events like `apify-default-dataset-item`:
206+
# the platform computes them from dataset writes asynchronously, so they propagate more slowly than
207+
# explicit charges (which are reflected immediately via the charge endpoint).
208+
for is_last_attempt, _ in retry_counter(120):
205209
await asyncio.sleep(1)
206210
updated_run = await apify_client_async.run(run.id).get()
207211
run = ActorRun.model_validate(updated_run)

0 commit comments

Comments
 (0)