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

refactor(source): extract concurrency checks and rpc fetches into separate Fetcher struct #58

Merged
merged 3 commits into from
Sep 5, 2023

Conversation

kskalski
Copy link
Contributor

@kskalski kskalski commented Sep 5, 2023

Motivation

Right now semaphore and rate-limiting code is spread and duplicated all over the code-base, some calls to rpc methods are actually missing them.

Solution

Create a wrapper for Provider that centralized all rpc accesses and makes sure concurrency controls are applied to all of them.
In future this might also allow easy introduction of re-tries in presence of network or transient target endpoint errors.

It's probably possible to make Fetcher implement Middleware trait and maybe reduce a bit some of the function signature changes, but at the moment this seemed easier and ensures all used rpc methods properly follows concurrency checks without overriding all middleware functions.

PR Checklist

  • [ adjusted existing test ] Added Tests
  • [ x ] Added Documentation
  • [ none ] Breaking changes

@sslivkoff
Copy link
Member

great solution. this cleans up a ton of code

@sslivkoff sslivkoff merged commit 7ca0073 into paradigmxyz:main Sep 5, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants