Skip to content

fix: Fix _is_empty_cache invalidation in FileSystemRequestQueueClient#1840

Closed
vdusek wants to merge 1 commit intomasterfrom
fix/fs-rq-is-empty-cache-invalidation
Closed

fix: Fix _is_empty_cache invalidation in FileSystemRequestQueueClient#1840
vdusek wants to merge 1 commit intomasterfrom
fix/fs-rq-is-empty-cache-invalidation

Conversation

@vdusek
Copy link
Copy Markdown
Collaborator

@vdusek vdusek commented Apr 8, 2026

Summary

  • Fix _is_empty_cache race condition in FileSystemRequestQueueClient where fetch_next_request was the only state-mutating method that didn't invalidate the cache, potentially causing stale is_empty() results
  • Add cache invalidation to fetch_next_request (conditionally, only when a request is actually found, to avoid hot-path waste)
  • Remove redundant early cache invalidation in add_batch_of_requests
  • Fix cache/return mismatch in is_empty fast path where _is_empty_cache was set to True but return value could theoretically differ

🤖 Generated with Claude Code

…RequestQueueClient`

Ensure all state-mutating operations properly invalidate the `_is_empty_cache`
to prevent stale values that could cause the crawler to shut down prematurely.

- Add cache invalidation to `fetch_next_request` (only when a request is found)
- Remove redundant early invalidation in `add_batch_of_requests`
- Fix cache/return mismatch in `is_empty` fast path
- Add tests for cache correctness through lifecycle and concurrent operations

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@vdusek vdusek added t-tooling Issues with this label are in the ownership of the tooling team. adhoc Ad-hoc unplanned task added during the sprint. labels Apr 8, 2026
@vdusek vdusek self-assigned this Apr 8, 2026
@github-actions github-actions bot added this to the 138th sprint - Tooling team milestone Apr 8, 2026
@github-actions github-actions bot added the tested Temporary label used only programatically for some analytics. label Apr 8, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 8, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.25%. Comparing base (8b53e27) to head (a4c1134).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
...rage_clients/_file_system/_request_queue_client.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1840      +/-   ##
==========================================
- Coverage   92.27%   92.25%   -0.02%     
==========================================
  Files         157      157              
  Lines       10909    10909              
==========================================
- Hits        10066    10064       -2     
- Misses        843      845       +2     
Flag Coverage Δ
unit 92.25% <50.00%> (-0.02%) ⬇️

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.

@vdusek vdusek marked this pull request as draft April 8, 2026 08:27
@vdusek vdusek closed this Apr 8, 2026
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