Skip to content

Fetch next request doesn't return just-added or reclaimed requests in shared RQ #808

Closed

Description

@vdusek

Context

Discovered during review of PR #803 (discussion).

The test_request_reclaim_functionality[shared] integration test is flaky because fetch_next_request() does not immediately return requests that were just added or reclaimed when using the shared request queue access mode. In the single mode, requests are added directly to the local queue_head deque and are available right away, but the shared client cannot do that.

Problem

When using shared request queue mode, there is a propagation delay between:

  1. Adding a request (or reclaiming one) via the API
  2. That request becoming visible in fetch_next_request()

This means users of the shared request queue mode may call fetch_next_request() and get None even though a request was just added or reclaimed.

Expected behavior

fetch_next_request() should reliably return requests that have been added or reclaimed, even in shared mode, without requiring the caller to implement their own retry/polling logic.

Current workaround

Callers need to poll fetch_next_request() with retries and delays to handle the propagation delay.

Activity

  1. added
    t-toolingIssues with this label are in the ownership of the tooling team.
    on Feb 20, 2026
  2. janbuchar commented on Feb 20, 2026

    @janbuchar
    Contributor

    Just noting, isn't the expected flow more like while not rq.is_finished(): next_request = rq.fetch()? In that case, the fix (which will probably be just "wait for some reasonable time of rq.is_empty() and rq.locked_request_count == 0") will probably fit better into the is_finished method.

  3. changed the title [-]Shared request queue: fetch_next_request does not immediately see newly added/reclaimed requests[/-] [+]Fetch next request doesn't return just-added or reclaimed requests in shared RQ[/+] on Jul 3, 2026
  4. vdusek commented on Aug 31, 2026

    @vdusek
    ContributorAuthor

    Closing as this was probably resolved by #1087

  5. self-assigned this
    on Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working.t-toolingIssues with this label are in the ownership of the tooling team.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions