Skip to content

Commit 16b76dd

Browse files
committed
Check _queue_has_locked_requests in is_empty
1 parent bc61fee commit 16b76dd

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/apify/storage_clients/_apify/_request_queue_client.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -361,14 +361,7 @@ async def is_empty(self) -> bool:
361361
"""
362362
head = await self._list_head(limit=1, lock_time=None)
363363

364-
# This if condition is necessary for proper functioning of the queue.
365-
# Investigate why it is needed and if it can be removed.
366-
if len(head.items) == 0:
367-
logger.warning('I am giving up, but I will sleep for a while before checking again.')
368-
await asyncio.sleep(10)
369-
head = await self._list_head(limit=1, lock_time=None)
370-
371-
return len(head.items) == 0
364+
return len(head.items) == 0 and not self._queue_has_locked_requests
372365

373366
async def _ensure_head_is_non_empty(self) -> None:
374367
"""Ensure that the queue head has requests if they are available in the queue."""

0 commit comments

Comments
 (0)