File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
src/apify/storage_clients/_apify Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -294,7 +294,7 @@ async def fetch_next_request(self) -> Request | None:
294
294
Returns:
295
295
The request or `None` if there are no more pending requests.
296
296
"""
297
- # Ensure the queue head has requests if available
297
+ # Ensure the queue head has requests if available. Fetching the head with lock to prevent race conditions.
298
298
async with self ._fetch_lock :
299
299
await self ._ensure_head_is_non_empty ()
300
300
@@ -304,7 +304,8 @@ async def fetch_next_request(self) -> Request | None:
304
304
305
305
# Get the next request ID from the queue head
306
306
next_request_id = self ._queue_head .popleft ()
307
- request = await self ._get_or_hydrate_request (next_request_id )
307
+
308
+ request = await self ._get_or_hydrate_request (next_request_id )
308
309
309
310
# Handle potential inconsistency where request might not be in the main table yet
310
311
if request is None :
You can’t perform that action at this time.
0 commit comments