Skip to content

Commit e276944

Browse files
committed
Fix some failing tests
1 parent 27bc060 commit e276944

2 files changed

Lines changed: 5 additions & 11 deletions

File tree

src/apify/storage_clients/_apify/_request_queue_single_client.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -258,16 +258,8 @@ async def _list_head(self) -> None:
258258

259259
# Update the cached data
260260
for request_data in response.get('items', []):
261-
# Due to https://github.com/apify/apify-core/blob/v0.1377.0/src/api/src/lib/request_queues/request_queue.ts#L53,
262-
# the list_head endpoint may return truncated fields for long requests (e.g., long URLs or unique keys).
263-
# If truncation is detected, fetch the full request data by its ID from the API.
264-
# This is a temporary workaround - the caching will be refactored to use request IDs instead of unique keys.
265-
# See https://github.com/apify/apify-sdk-python/issues/630 for details.
266-
if '[truncated]' in request_data['uniqueKey'] or '[truncated]' in request_data['url']:
267-
request_data = await self._api_client.get_request(request_id=request_data['id']) # noqa: PLW2901
268-
269261
request = Request.model_validate(request_data)
270-
request_id = unique_key_to_request_id(request_data['id'])
262+
request_id = request_data['id']
271263

272264
if request_id in self._requests_in_progress:
273265
# Ignore requests that are already in progress, we will not process them again.
@@ -405,8 +397,10 @@ async def _update_request(
405397
Returns:
406398
The updated request
407399
"""
400+
request_dict = request.model_dump(by_alias=True)
401+
request_dict['id'] = unique_key_to_request_id(request.unique_key)
408402
response = await self._api_client.update_request(
409-
request=request.model_dump(by_alias=True),
403+
request=request_dict,
410404
forefront=forefront,
411405
)
412406

tests/integration/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def apify_client_async(apify_token: str) -> ApifyClientAsync:
107107
return ApifyClientAsync(apify_token, api_url=api_url)
108108

109109

110-
@pytest.fixture(params=['shared'])
110+
@pytest.fixture(params=['single', 'shared'])
111111
async def request_queue_apify(
112112
apify_token: str, monkeypatch: pytest.MonkeyPatch, request: pytest.FixtureRequest
113113
) -> AsyncGenerator[RequestQueue]:

0 commit comments

Comments
 (0)