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(chainHead_v1): operationWaitingForContinue and chainHead_v1_continue #838

Merged
merged 2 commits into from
Oct 16, 2024

Conversation

voliva
Copy link
Contributor

@voliva voliva commented Oct 15, 2024

I've added pagination by performing storage queries with 1000 values at a time, then storing the pending requests on the "callbacks" map we had, which I have repurposed to better represent the state of each follow subscription.

I also added a test by querying a storage query that has more than 1000 values, but without being too much. I've found System.BlockHash has 1201 entries, so I thought that's a good candidate. Let me know if I should change this for a better alternative.

Closes #837

prefix: string
startKey: string
}
const following = new Map<
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One downside about global variables is that for some use cases, we need to handle chopsticks instances running at a same time (e.g. unit tests) so need to ensure they don't interfere with each other.
In this particular case, it is fine as everything is indexed by a unique random ID. The only drawback I can see is potential memory leak (i.e. destroy a chopsticks instance will not clear entry here). But that's not a very big deal here.
So this is ok for now. Maybe later refactor this into context somehow.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}>
next: DescendantValuesParams | null
}> {
const pageSize = 100
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you have 2 page_size and one is 1000 and one is 100?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad - leftover from previous code.

Thanks for pointing it out!

@xlc xlc merged commit ac3d39e into AcalaNetwork:master Oct 16, 2024
6 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.

PAPI storage getEntries() returns only 100 entries
2 participants