@@ -286,24 +286,31 @@ def batch_add_requests(
286
286
requests : list [dict ],
287
287
* ,
288
288
forefront : bool = False ,
289
+ max_parallel : int = 1 ,
289
290
max_unprocessed_requests_retries : int = 3 ,
290
291
min_delay_between_unprocessed_requests_retries : timedelta = timedelta (milliseconds = 500 ),
291
292
) -> BatchAddRequestsResult :
292
293
"""Add requests to the request queue in batches.
293
294
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 .
295
296
296
297
https://docs.apify.com/api/v2#/reference/request-queues/batch-request-operations/add-requests
297
298
298
299
Args:
299
300
requests: List of requests to be added to the queue.
300
301
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.
301
305
max_unprocessed_requests_retries: Number of retry attempts for unprocessed requests.
302
306
min_delay_between_unprocessed_requests_retries: Minimum delay between retry attempts for unprocessed requests.
303
307
304
308
Returns:
305
309
Result containing lists of processed and unprocessed requests.
306
310
"""
311
+ if max_parallel != 1 :
312
+ raise NotImplementedError ('max_parallel is only supported in async client' )
313
+
307
314
request_params = self ._params (clientKey = self .client_key , forefront = forefront )
308
315
309
316
# Compute the payload size limit to ensure it doesn't exceed the maximum allowed size.
@@ -707,7 +714,9 @@ async def batch_add_requests(
707
714
Args:
708
715
requests: List of requests to be added to the queue.
709
716
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.
711
720
max_unprocessed_requests_retries: Number of retry attempts for unprocessed requests.
712
721
min_delay_between_unprocessed_requests_retries: Minimum delay between retry attempts for unprocessed requests.
713
722
0 commit comments