Skip to content

Commit 70908b3

Browse files
committed
Add logging for debug
1 parent 4bc5c91 commit 70908b3

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/apify/storage_clients/_apify/_request_queue_client.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ async def add_batch_of_requests(
255255

256256
else:
257257
new_requests.append(request)
258-
258+
logger.info(f'Add new requests: {len(new_requests)}, already present requests: {len(already_present_requests)}')
259259
if new_requests:
260260
# Prepare requests for API by converting to dictionaries.
261261
requests_dict = [
@@ -267,6 +267,7 @@ async def add_batch_of_requests(
267267
]
268268

269269
# Send requests to API.
270+
logger.info(f'self._api_client.batch_add_requests, {len(new_requests)=}')
270271
response = await self._api_client.batch_add_requests(requests=requests_dict, forefront=forefront)
271272
# Add new requests to the cache.
272273
for processed_request_raw in response['processedRequests']:
@@ -302,6 +303,7 @@ async def get_request(self, request_id: str) -> Request | None:
302303
Returns:
303304
The request or None if not found.
304305
"""
306+
logger.info(f'self._api_client.get_request, {request_id=}')
305307
response = await self._api_client.get_request(request_id)
306308

307309
if response is None:
@@ -553,6 +555,7 @@ async def _update_request(
553555
Returns:
554556
The updated request
555557
"""
558+
logger.info(f'self._api_client.update_request, {len(request.id)=}')
556559
response = await self._api_client.update_request(
557560
request=request.model_dump(by_alias=True),
558561
forefront=forefront,
@@ -604,6 +607,7 @@ async def _list_head(
604607
lock_time = lock_time or self._DEFAULT_LOCK_TIME
605608
lock_secs = int(lock_time.total_seconds())
606609

610+
logger.info('self._api_client.list_and_lock_head')
607611
response = await self._api_client.list_and_lock_head(
608612
lock_secs=lock_secs,
609613
limit=limit,
@@ -685,6 +689,7 @@ async def _prolong_request_lock(
685689
Returns:
686690
A response containing the time at which the lock will expire.
687691
"""
692+
logger.info(f'self._api_client.prolong_request_lock, {request_id=}')
688693
response = await self._api_client.prolong_request_lock(
689694
request_id=request_id,
690695
forefront=forefront,
@@ -716,6 +721,7 @@ async def _delete_request_lock(
716721
forefront: Whether to put the request in the beginning or the end of the queue after the lock is deleted.
717722
"""
718723
try:
724+
logger.info(f'self._api_client.delete_request_lock, {request_id=}')
719725
await self._api_client.delete_request_lock(
720726
request_id=request_id,
721727
forefront=forefront,

tests/integration/test_actor_request_queue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ async def main() -> None:
143143
stats_after = (await Actor.apify_client.request_queue(request_queue_id=rq.id).get()).get('stats', {})
144144
Actor.log.info(stats_after)
145145

146-
assert (stats_after['writeCount'] - stats_before['writeCount']) == 1
146+
assert (stats_after['writeCount'] - stats_before['writeCount']) == 1
147147

148148
actor = await make_actor(label='rq-deduplication', main_func=main)
149149
run_result = await run_actor(actor)

0 commit comments

Comments
 (0)