Skip to content

fix: correct reclaim_request count adjustment for already-handled requests#973

Open
vdusek wants to merge 5 commits into
masterfrom
fix/single-rq-client-returns-handled-requests
Open

fix: correct reclaim_request count adjustment for already-handled requests#973
vdusek wants to merge 5 commits into
masterfrom
fix/single-rq-client-returns-handled-requests

Conversation

@vdusek

@vdusek vdusek commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix handled/pending count drift when reclaiming an already-handled request in the Apify request queue clients (single and shared modes).

When a previously handled request is reclaimed, it must move back from handled to pending in the queue metadata. The counter adjustment now keys off the platform's update_request response: on a PUT, wasAlreadyHandled reports the request's state before the update (verified against the real API), so handled is decremented and pending incremented exactly when processed_request.was_already_handled is True. This mirrors mark_request_as_handled, which increments on the inverse condition.

Covered by an integration test parametrized over single/shared modes that verifies the real handled→pending transition.

@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 Jun 12, 2026
@vdusek vdusek self-assigned this Jun 12, 2026
@github-actions github-actions Bot added this to the 142nd sprint - Tooling team milestone Jun 12, 2026
@github-actions github-actions Bot added the tested Temporary label used only programatically for some analytics. label Jun 12, 2026
@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.10%. Comparing base (0daca28) to head (29967d1).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #973      +/-   ##
==========================================
+ Coverage   89.90%   90.10%   +0.19%     
==========================================
  Files          49       49              
  Lines        3091     3091              
==========================================
+ Hits         2779     2785       +6     
+ Misses        312      306       -6     
Flag Coverage Δ
e2e 35.91% <0.00%> (ø)
integration 57.06% <100.00%> (+0.19%) ⬆️
unit 78.74% <0.00%> (ø)

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

☔ View full report in Codecov by Harness.
📢 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.

@vdusek vdusek changed the title fix: skip already-handled requests in single RQ client's fetch_next_request fix: correct handled-request handling in Apify request queue clients Jun 12, 2026
vdusek added 2 commits June 12, 2026 18:28
…t-returns-handled-requests

# Conflicts:
#	tests/unit/storage_clients/test_apify_request_queue_client.py
@vdusek vdusek changed the title fix: correct handled-request handling in Apify request queue clients fix: correct reclaim_request counter adjustment in Apify request queue clients Jun 12, 2026
@vdusek vdusek changed the title fix: correct reclaim_request counter adjustment in Apify request queue clients fix: correct reclaim_request count adjustment for already-handled requests Jun 13, 2026
@vdusek vdusek requested a review from Pijukatel June 13, 2026 08:09
@vdusek vdusek marked this pull request as ready for review June 13, 2026 08:09
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