Skip to content

Commit 1147216

Browse files
committed
sync and async versions have the same interface and docstring
1 parent 28cdd1c commit 1147216

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/apify_client/clients/resource_clients/request_queue.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,24 +286,31 @@ def batch_add_requests(
286286
requests: list[dict],
287287
*,
288288
forefront: bool = False,
289+
max_parallel: int = 1,
289290
max_unprocessed_requests_retries: int = 3,
290291
min_delay_between_unprocessed_requests_retries: timedelta = timedelta(milliseconds=500),
291292
) -> BatchAddRequestsResult:
292293
"""Add requests to the request queue in batches.
293294
294-
Requests are split into batches based on size and processed sequentially.
295+
Requests are split into batches based on size and processed in parallel.
295296
296297
https://docs.apify.com/api/v2#/reference/request-queues/batch-request-operations/add-requests
297298
298299
Args:
299300
requests: List of requests to be added to the queue.
300301
forefront: Whether to add requests to the front of the queue.
302+
max_parallel: Specifies the maximum number of parallel tasks for API calls. This is only applicable
303+
to the async client. For the sync client, this value must be set to 1, as parallel execution
304+
is not supported.
301305
max_unprocessed_requests_retries: Number of retry attempts for unprocessed requests.
302306
min_delay_between_unprocessed_requests_retries: Minimum delay between retry attempts for unprocessed requests.
303307
304308
Returns:
305309
Result containing lists of processed and unprocessed requests.
306310
"""
311+
if max_parallel != 1:
312+
raise NotImplementedError('max_parallel is only supported in async client')
313+
307314
request_params = self._params(clientKey=self.client_key, forefront=forefront)
308315

309316
# Compute the payload size limit to ensure it doesn't exceed the maximum allowed size.
@@ -707,7 +714,9 @@ async def batch_add_requests(
707714
Args:
708715
requests: List of requests to be added to the queue.
709716
forefront: Whether to add requests to the front of the queue.
710-
max_parallel: Maximum number of parallel tasks for API calls.
717+
max_parallel: Specifies the maximum number of parallel tasks for API calls. This is only applicable
718+
to the async client. For the sync client, this value must be set to 1, as parallel execution
719+
is not supported.
711720
max_unprocessed_requests_retries: Number of retry attempts for unprocessed requests.
712721
min_delay_between_unprocessed_requests_retries: Minimum delay between retry attempts for unprocessed requests.
713722

0 commit comments

Comments
 (0)