5
5
import math
6
6
from collections .abc import Iterable
7
7
from queue import Queue
8
- from typing import Any , TypedDict
8
+ from typing import TYPE_CHECKING , Any , TypedDict
9
9
10
10
from apify_shared .utils import filter_out_none_values_recursively , ignore_docs , parse_date_fields
11
11
from more_itertools import constrained_batches
14
14
from apify_client ._utils import catch_not_found_or_throw , pluck_data
15
15
from apify_client .clients .base import ResourceClient , ResourceClientAsync
16
16
17
+ if TYPE_CHECKING :
18
+ from datetime import timedelta
19
+
17
20
logger = logging .getLogger (__name__ )
18
21
19
22
_RQ_MAX_REQUESTS_PER_BATCH = 25
@@ -279,6 +282,8 @@ def batch_add_requests(
279
282
* ,
280
283
forefront : bool = False ,
281
284
max_parallel : int = 1 ,
285
+ max_unprocessed_requests_retries : int | None = None ,
286
+ min_delay_between_unprocessed_requests_retries : timedelta | None = None ,
282
287
) -> BatchAddRequestsResult :
283
288
"""Add requests to the request queue in batches.
284
289
@@ -292,10 +297,17 @@ def batch_add_requests(
292
297
max_parallel: Specifies the maximum number of parallel tasks for API calls. This is only applicable
293
298
to the async client. For the sync client, this value must be set to 1, as parallel execution
294
299
is not supported.
300
+ max_unprocessed_requests_retries: Deprecated argument. Will be removed in next major release.
301
+ min_delay_between_unprocessed_requests_retries: Deprecated argument. Will be removed in next major release.
295
302
296
303
Returns:
297
304
Result containing lists of processed and unprocessed requests.
298
305
"""
306
+ if max_unprocessed_requests_retries :
307
+ logger .warning ('`max_unprocessed_requests_retries` is deprecated and not used anymore.' )
308
+ if min_delay_between_unprocessed_requests_retries :
309
+ logger .warning ('`min_delay_between_unprocessed_requests_retries` is deprecated and not used anymore.' )
310
+
299
311
if max_parallel != 1 :
300
312
raise NotImplementedError ('max_parallel is only supported in async client' )
301
313
@@ -678,6 +690,8 @@ async def batch_add_requests(
678
690
* ,
679
691
forefront : bool = False ,
680
692
max_parallel : int = 5 ,
693
+ max_unprocessed_requests_retries : int | None = None ,
694
+ min_delay_between_unprocessed_requests_retries : timedelta | None = None ,
681
695
) -> BatchAddRequestsResult :
682
696
"""Add requests to the request queue in batches.
683
697
@@ -691,10 +705,17 @@ async def batch_add_requests(
691
705
max_parallel: Specifies the maximum number of parallel tasks for API calls. This is only applicable
692
706
to the async client. For the sync client, this value must be set to 1, as parallel execution
693
707
is not supported.
708
+ max_unprocessed_requests_retries: Deprecated argument. Will be removed in next major release.
709
+ min_delay_between_unprocessed_requests_retries: Deprecated argument. Will be removed in next major release.
694
710
695
711
Returns:
696
712
Result containing lists of processed and unprocessed requests.
697
713
"""
714
+ if max_unprocessed_requests_retries :
715
+ logger .warning ('`max_unprocessed_requests_retries` is deprecated and not used anymore.' )
716
+ if min_delay_between_unprocessed_requests_retries :
717
+ logger .warning ('`min_delay_between_unprocessed_requests_retries` is deprecated and not used anymore.' )
718
+
698
719
tasks = set [asyncio .Task ]()
699
720
queue : asyncio .Queue [Iterable [dict ]] = asyncio .Queue ()
700
721
request_params = self ._params (clientKey = self .client_key , forefront = forefront )
0 commit comments