-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: batch add requests can handle more than 25 requests (#268)
### Description - RQ's batch add requests can handle more than 25 requests. - It was implemented in the same way as in the TS client. - Applies for both sync & async versions. - I do not use multi-threading for the sync version, since it is out of the scope of this issue. If users want performance, they should go with the client's async version. But if we decide it is worth to implement it, let's open another issue. ### Issues - Closes: #264 ### Testing It was tested on this code sample (plus the sync alternative): ```python import asyncio from apify_client import ApifyClientAsync from crawlee._utils.crypto import get_random_id TOKEN = '...' async def main() -> None: apify_client = ApifyClientAsync(token=TOKEN) rqs_client = apify_client.request_queues() rq = await rqs_client.get_or_create(name='my-rq') rq_client = apify_client.request_queue(rq['id']) print('Add a single request...') result_1 = await rq_client.add_request({'url': 'http://example.com', 'uniqueKey': get_random_id()}) print(f'result: {result_1}') print('Add multiple requests...') requests = [ { 'url': f'https://example.com/{i}/', 'uniqueKey': get_random_id(), } for i in range(110) ] result_2 = await rq_client.batch_add_requests(requests) print(f'result: {result_2}') if __name__ == '__main__': asyncio.run(main()) ``` ### Checklist - [x] CI passed
- Loading branch information
Showing
3 changed files
with
235 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters