test: deflake request queue fetch-and-handle integration tests#991
Open
vdusek wants to merge 1 commit into
Open
test: deflake request queue fetch-and-handle integration tests#991vdusek wants to merge 1 commit into
vdusek wants to merge 1 commit into
Conversation
The Apify request queue has at-least-once delivery, so mark_request_as_handled can occasionally report was_already_handled=True when a request is fetched again before its handled state propagates. Count only first-time handles instead of asserting every mark is the first.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #991 +/- ##
==========================================
- Coverage 90.35% 90.32% -0.04%
==========================================
Files 49 49
Lines 3089 3089
==========================================
- Hits 2791 2790 -1
- Misses 298 299 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test_add_and_fetch_requests[single](and its siblingstest_add_requests_in_batchesandtest_add_non_unique_requests_in_batch) intermittently failed in CI onqueue_operation_info.was_already_handled is False.The Apify request queue has at-least-once delivery. A request can occasionally be fetched again before the platform propagates its handled state, so
mark_request_as_handledreportswas_already_handled=True(the state before the update) on the duplicate. The single-mode client already does best-effort local dedup and documents this as a low-probability race and API propagation delay, so the queue contract is at-least-once, not exactly-once.These tests asserted exactly-once delivery on every mark. They now count only first-time handles (
if not was_already_handled), which keeps thehandled_request_count == desired_request_countinvariant while tolerating the occasional duplicate. See #808.