Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rpc batch requests #1125

Merged
merged 8 commits into from
Jul 26, 2024
Merged

Conversation

ugur-eren
Copy link
Contributor

@ugur-eren ugur-eren commented May 13, 2024

Motivation and Resolution

The BatchClient class allows requests to be batched together, either by the interval amount, or at the end of the callback queue if set to 0. By batching requests, we can reduce the overhead associated with handling individual requests, optimize resource utilization and improve overall performance.

Request:
Screenshot 2024-05-13 184213

Response:
Screenshot 2024-05-13 184236

closes #758

Usage related changes

  • batch option added to RpcProvider options.

Development related changes

  • BatchClient class created to manage batching of requests.

Checklist:

  • Performed a self-review of the code
  • Rebased to the last commit of the target branch (or merged it into my branch)
  • Linked the issues which this PR resolves
  • Documented the changes in code (API docs will be generated automatically)
  • Updated the tests
  • All tests are passing

@ugur-eren ugur-eren marked this pull request as draft May 13, 2024 16:49
@ugur-eren ugur-eren marked this pull request as ready for review May 14, 2024 10:19
@tabaktoni
Copy link
Collaborator

I haven't gone into details yet, on first look, it seems good, but we need tests.
Can you please add tests for new Classes and Batch requests, we must have tests for it before merging.
Can you add a section to www/ documentation about usage? (optional - this can be done in separate PR)

@tabaktoni tabaktoni added the pending need update label Jun 13, 2024
@ugur-eren
Copy link
Contributor Author

ugur-eren commented Jun 25, 2024

Hi @tabaktoni sorry for late reply, I didn't see the notification.
I will add the tests ASAP. There is only a single function to test, won't take long.
But about documentation, the new Batch class is only used in the RpcChannel class, it's not used externally and is not exported. If it's not preferred to have a class for this, we can also convert it to a function. But I thought a class would be easier and cleaner.
Only usage change is a new batch option. I will add this option to the documentation.

@ugur-eren
Copy link
Contributor Author

Hi @tabaktoni sorry for late reply. I've added tests and also moved the BatchClient class to utils, instead of the src. It is ready to review.

@tabaktoni tabaktoni self-requested a review July 19, 2024 15:42
@tabaktoni tabaktoni changed the base branch from develop to next-version July 23, 2024 07:37
@tabaktoni tabaktoni added done ready and removed pending need update labels Jul 25, 2024
@tabaktoni tabaktoni merged commit c10cfe3 into starknet-io:next-version Jul 26, 2024
3 checks passed
Copy link

🎉 This issue has been resolved in version 6.12.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@ugur-eren ugur-eren deleted the feat-rpc-batch branch July 26, 2024 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[V6] Implement RPC Batch
3 participants