Skip to content

fix: retry a locked shared RQ request that is not found yet - #1207

Open
vdusek wants to merge 4 commits into
masterfrom
fix/shared-rq-requeue-not-found
Open

vdusek wants to merge 4 commits into
masterfrom
fix/shared-rq-requeue-not-found

Conversation

@vdusek

@vdusek vdusek commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

In shared mode, fetch_next_request returned None when get_request couldn't find a request that list_and_lock_head had just locked. It also removed the ID from the local queue head but kept the 3-minute platform lock. Later head listings skip locked requests, so neither this client nor any other consumer could fetch the request until the lock expired.

This showed up as a flake of test_shared_is_finished_false_while_request_in_progress (run). It polled fetch_next_request for 30 s and never got the request. #1105 added that polling, but polling can't get past a 3-minute lock.

Both not-found paths now put the ID back on the local queue head, so the next fetch retries it. If the request never shows up, the lock check in _ensure_lock_window drops it, so it isn't retried forever. Two unit tests cover the paths: the plain cache hit, and a request evicted from the cache.

✍️ Drafted by Claude Code

@github-actions github-actions Bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Oct 26, 2026
@apify-service-account apify-service-account added the tested Temporary label used only programatically for some analytics. label Oct 26, 2026
@vdusek vdusek added the adhoc Ad-hoc unplanned task added during the sprint. label Oct 26, 2026
@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.50%. Comparing base (5fbbf76) to head (c172de8).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1207      +/-   ##
==========================================
+ Coverage   93.09%   93.50%   +0.40%     
==========================================
  Files          54       54              
  Lines        3708     3710       +2     
==========================================
+ Hits         3452     3469      +17     
+ Misses        256      241      -15     
Flag Coverage Δ
e2e 31.56% <0.00%> (-0.02%) ⬇️
integration 51.56% <33.33%> (-0.03%) ⬇️
unit 90.61% <100.00%> (+0.73%) ⬆️

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 marked this pull request as draft October 26, 2026 07:36
@vdusek
vdusek requested a review from Pijukatel October 26, 2026 14:02
@vdusek
vdusek marked this pull request as ready for review October 26, 2026 14:02

This branch has not been deployed

No deployments
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