Skip to content

Fix/reduce sync requests #62

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

Merged
merged 8 commits into from
Oct 21, 2024
Merged

Fix/reduce sync requests #62

merged 8 commits into from
Oct 21, 2024

Conversation

jordy25519
Copy link
Collaborator

@jordy25519 jordy25519 commented Oct 21, 2024

Motivation:
The client makes too many network requests by default. This PR aims to reduce the total number of requests made by the client to only those being used by the caller.

currently the client provides one method to subscribe to all markets and oracles
this PR makes it more flexible allowing caller to decide the necessary markets.

Changes

external

  • Split client subscribe method into parts: subscribe_markets, subscribe_oracles, subscribe_block_hashes
  • subscribe_markets and subscribe_oracles receive a list of markets to subscribe for
  • Oracle related methods take MarketId struct rather than oracle pubkeys
  • sync/best effort methods on the client are prefixed with try_ e.g. try_get_oracle_price to distinguish from async methods

internal

  • Previously, OracleMap uses GPA to get all markets now it uses individual Ws subs based on user's requirement.
    if GPA is needed likely for some generic filler then that can be re-added later
  • adds some chunking of RPC requests during syncing of market and oracle accounts (helps with rate limits)
  • WebSocketAccount subscriber no longer fetches the account on start up by default. This made extra requests since most subscribes already had a previous sync step (helps with rate limits)

Other

  • use ahash over fnv for most maps
  • shadow MarketType from program to allow using MarketId as map keys
  • fix some doc comments

closes #60

@jordy25519 jordy25519 merged commit ad92773 into main Oct 21, 2024
@jordy25519 jordy25519 deleted the fix/reduce-sync-requests branch October 21, 2024 11:20
@jordy25519 jordy25519 mentioned this pull request Oct 22, 2024
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.

lazy load maps
1 participant