fix: commit request queue dedup cache only after batch_add_requests succeeds#975
Draft
vdusek wants to merge 3 commits into
Draft
fix: commit request queue dedup cache only after batch_add_requests succeeds#975vdusek wants to merge 3 commits into
vdusek wants to merge 3 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #975 +/- ##
==========================================
+ Coverage 89.90% 89.98% +0.07%
==========================================
Files 49 49
Lines 3091 3105 +14
==========================================
+ Hits 2779 2794 +15
+ Misses 312 311 -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:
|
…-on-success # Conflicts: # tests/unit/storage_clients/test_apify_request_queue_client.py
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.
Both Apify request queue clients (
ApifyRequestQueueSingleClient,ApifyRequestQueueSharedClient) inserted new requests into their local_requests_cache(and the single client's_head_requests) before callingbatch_add_requests. When that API call failed, the poisoned cache entries caused a subsequent user retry of the same request to be deduplicated locally and never re-sent to the platform — silent request loss.The cache/head commit now happens after
batch_add_requestssucceeds, committing only the requests the platform actually accepted (entries inunprocessed_requestsare skipped). The previous "remove unprocessed from cache" cleanup loops are absorbed into this skip, since those ids are simply never added now.Crawlee already deduplicates a batch by
unique_key(via_transform_requests) before it reaches these clients, so deferring the local cache write does not lose meaningful within-batch deduplication.Added a parametrized regression test covering both clients: a failed
batch_add_requestsleaves no cached entry, and the retry reaches the platform.