Skip to content

test: Add exponential backoff for shared RQ propagation delay in integration tests#831

Merged
vdusek merged 3 commits intomasterfrom
fix/flaky-integration-tests-shared-rq
Mar 13, 2026
Merged

test: Add exponential backoff for shared RQ propagation delay in integration tests#831
vdusek merged 3 commits intomasterfrom
fix/flaky-integration-tests-shared-rq

Conversation

@vdusek
Copy link
Contributor

@vdusek vdusek commented Mar 13, 2026

Summary

  • Added call_with_exp_backoff(rq.fetch_next_request) for shared mode in all integration tests that fetch requests right after adding/reclaiming them
  • Restructured while-loops to use backoff on the first fetch, preventing premature loop exit when the API hasn't propagated yet
  • Added request: pytest.FixtureRequest parameter to tests that were missing it for shared mode detection
  • All changes reference the known propagation delay issue Shared request queue: fetch_next_request does not immediately see newly added/reclaimed requests #808

Test plan

  • Integration tests pass in CI (both single and shared parameterizations)
  • No more sporadic test_rq_long_url[shared] failures (and similar tests)

🤖 Generated with Claude Code

@vdusek vdusek added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Mar 13, 2026
@vdusek vdusek self-assigned this Mar 13, 2026
@vdusek vdusek added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Mar 13, 2026
@github-actions github-actions bot added this to the 136th sprint - Tooling team milestone Mar 13, 2026
@github-actions github-actions bot added the tested Temporary label used only programatically for some analytics. label Mar 13, 2026
@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.44%. Comparing base (d808305) to head (3e28576).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #831      +/-   ##
==========================================
- Coverage   86.47%   86.44%   -0.04%     
==========================================
  Files          48       48              
  Lines        2899     2899              
==========================================
- Hits         2507     2506       -1     
- Misses        392      393       +1     
Flag Coverage Δ
e2e 38.11% <ø> (ø)
integration 59.57% <ø> (-0.04%) ⬇️
unit 74.40% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…ration tests

In shared request queue mode, the Apify API has an eventual consistency
propagation delay before newly added or reclaimed requests become visible
in fetch_next_request(). Many integration tests were missing the
call_with_exp_backoff() retry pattern, causing sporadic failures.

Also added rq_access_mode parameter to call_with_exp_backoff() so callers
can pass it directly instead of wrapping every call in an if/else block.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vdusek vdusek force-pushed the fix/flaky-integration-tests-shared-rq branch from 2b86354 to cba00a1 Compare March 13, 2026 08:55
@vdusek vdusek changed the title fix: Add exponential backoff for shared RQ propagation delay in integration tests test: Add exponential backoff for shared RQ propagation delay in integration tests Mar 13, 2026
@vdusek vdusek force-pushed the fix/flaky-integration-tests-shared-rq branch from a62c882 to ac81511 Compare March 13, 2026 09:15
@vdusek vdusek force-pushed the fix/flaky-integration-tests-shared-rq branch from f0caed1 to f20c29f Compare March 13, 2026 09:30
@vdusek vdusek requested a review from Pijukatel March 13, 2026 09:36
Using call_with_exp_backoff in `while not is_empty/is_finished` loop
conditions caused infinite loops in shared mode — the backoff retried
3 times (7s) per iteration even when the queue legitimately had items,
leading to 1800s+ timeouts on large batches. Replaced with walrus
operator `while request := await call_with_exp_backoff(fetch_next_request)`
pattern in test_large_batch_operations, test_persistence_across_operations,
and test_concurrent_processing_simulation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vdusek vdusek merged commit e343ed5 into master Mar 13, 2026
31 checks passed
@vdusek vdusek deleted the fix/flaky-integration-tests-shared-rq branch March 13, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants