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

getInvites doesn't reliably return full list #1963

Open
chuck-h opened this issue Nov 12, 2024 · 0 comments
Open

getInvites doesn't reliably return full list #1963

chuck-h opened this issue Nov 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@chuck-h
Copy link
Collaborator

chuck-h commented Nov 12, 2024

Describe the bug
Randomly (probably depending on rpc node and loading) the InviteRepository.getInvites() function returns an incomplete list of claimed invites

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Explore/Invite a Friend'
  2. Click on 'Manage Invites'
  3. Observe list of Claimed invites

Current behavior
A truncated list appears (sometimes, randomly)

Expected behavior
A full, scrollable list appears

Screenshots
image

But there are actually 22 claimed entries:

curl -s -X 'POST'   'https://telos.caleos.io/v1/chain/get_table_rows'   -H 'accept: application/json'   -H 'Content-Type: application/json'   -d '{
  "code": "join.seeds",
  "table": "invites",
  "scope": "join.seeds",
  "index_position": "3",
  "key_type": "i64",
  "encode_type": "string",
  "upper_bound": "chuckseattle",
  "lower_bound": "chuckseattle",
  "limit": 200,
  "json": true
}' | jq -r '[ .rows[] | select(.account != "") ] | length '
22

Platform & App Version

  • Observed on Android, not tested on iOS
  • App Version 2.9.4

Additional context
InviteRepository.getInvites() uses a secondary index with lowerBound == upperBound.
image

This request pattern cannot be paginated in the normal way if the rpc node fails to return the full list (which is a completely legal response). This post suggests a workaround based on redefining the table index (uggh)
https://eosio.stackexchange.com/questions/5338/how-do-i-lookup-multiple-entries-by-same-secondary-indices-with-more-than-limit

A hack would be to retry the api call a few times if the "more" field is true, and hope for a full list eventually. This pattern will break on very long lists. Perhaps show a "more" indication to user if we know the list is incomplete.

Another quick fix would be to get the list in reverse order, so at least if we get a truncated return the most recent claims show up (which are most likely what the user is interested in).

@chuck-h chuck-h added the bug Something isn't working label Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant