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

[MEX-693] Performance optimisations on user queries #1568

Merged

Conversation

mad2sm0key
Copy link
Contributor

@mad2sm0key mad2sm0key commented Feb 19, 2025

Reasoning

  1. In the current implementation, the userNfts query uses a pending executor to ensure a sinlge API call is made for fetching the users MetaESDT tokens. If the response time from the API is fast, the pending exector will still make multiple identical requests to the API (it does not guarantee a single request)

  2. Token identifiers returned by SC views are data points that don't change often. The current implementation uses a cache TTL of 10 minutes, which means (usually) API calls for fetching token IDs from contracts happen often

Proposed Changes

  • perform a single API request for fetching all of the users MetaESDT tokens in the root level userNfts query and store the result in the UserNftsModel. The resolve field methods are able to use this without performing extra requests
  • add special CacheTtlInfo property for token IDs with a TTL of 1 day
  • add caching to getNftByTokenIdentifier API call

How to test

  • N/A

@mad2sm0key mad2sm0key marked this pull request as ready for review February 20, 2025 10:00
@claudiulataretu claudiulataretu merged commit 1456fd0 into development Feb 21, 2025
1 check failed
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.

3 participants