File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -563,13 +563,9 @@ async def test_request_queue_unlock_requests(client: ApifyClient | ApifyClientAs
563563 assert len (lock_response .items ) == 3
564564 locked_ids = {item .id for item in lock_response .items }
565565
566- # Wait for the locks to propagate before unlocking (eventual consistency): the lock-head response
567- # is acknowledged before all three lock writes are visible to subsequent reads, so unlocking
568- # immediately can see fewer locks than were just acquired. Locked requests are excluded from the
569- # queue head, so poll `list_head` until none of the locked requests reappear there, rather than
570- # guessing a fixed sleep. Note this is a best-effort mitigation: the head read and the unlock may
571- # be served by different replicas, so convergence of one does not guarantee the other — but it
572- # narrows the race window enough in practice.
566+ # Locks are acknowledged before they are visible to subsequent reads, so unlocking immediately can
567+ # see fewer locks than were just acquired. Since locked requests are excluded from the queue head,
568+ # poll `list_head` until the locked IDs disappear from it (best-effort mitigation of the race).
573569 async def all_locks_visible () -> bool :
574570 head = await maybe_await (rq_client .list_head (limit = 5 ))
575571 assert isinstance (head , RequestQueueHead )
You can’t perform that action at this time.
0 commit comments