Skip to content

Commit 1b68d1a

Browse files
committed
Review comments
1 parent 70a1b71 commit 1b68d1a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/apify/storage_clients/_apify/_request_queue_client.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def __init__(
7070
self._fetch_lock = asyncio.Lock()
7171
"""Fetch lock to minimize race conditions when communicating with API."""
7272

73-
async def _get_metadata(self) -> RequestQueueMetadata:
73+
async def _get_metadata_estimate(self) -> RequestQueueMetadata:
7474
"""Try to get cached metadata first. If multiple clients, fuse with global metadata.
7575
7676
This method is used internally to avoid unnecessary API call unless needed (multiple clients).
@@ -84,7 +84,12 @@ async def _get_metadata(self) -> RequestQueueMetadata:
8484

8585
@override
8686
async def get_metadata(self) -> RequestQueueMetadata:
87-
"""Get metadata about the request queue."""
87+
"""Get metadata about the request queue.
88+
89+
Returns:
90+
Metadata from the API, merged with local estimation, because in some cases, the data from the API can
91+
be delayed.
92+
"""
8893
response = await self._api_client.get()
8994
if response is None:
9095
raise ValueError('Failed to fetch request queue metadata from the API.')
@@ -613,7 +618,7 @@ async def _list_head(
613618
if cached_request and cached_request.hydrated:
614619
items.append(cached_request.hydrated)
615620

616-
metadata = await self._get_metadata()
621+
metadata = await self._get_metadata_estimate()
617622

618623
return RequestQueueHead(
619624
limit=limit,

0 commit comments

Comments
 (0)