-
Notifications
You must be signed in to change notification settings - Fork 352
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
Endblock feature #2064
Endblock feature #2064
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. I think there still needs to be some updates for dictionary queries.
We also need some tests please
], | ||
], | ||
[201, [{startBlock: 1, endBlock: 300}]], | ||
[301, []], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this can happen then the indexer will exit because of
subql/packages/node-core/src/indexer/blockDispatcher/base-block-dispatcher.ts
Lines 212 to 215 in 5c3142b
if (!(await this.projectService.hasDataSourcesAfterHeight(height))) { | |
logger.info(`All data sources have been processed up to block number ${height}. Exiting gracefully...`); | |
await this.storeCacheService.flushCache(false, true); | |
process.exit(0); |
We either need to support this correctly in the fetch service when enqueuing blocks or throw an error if this happens
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If no datasources are available to index a specific blockheight we throw this error:
should we change this behaviour to somehow skip blocks that has no datasources?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that happens too late on having to index to that height to see the error.
I think we can skip blocks, its should be relatively easy to do
[ | ||
1, | ||
{ | ||
dataSources: [{startBlock: 1}], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a pre-existing bug buy if this change is made then it will produce a different result but the expected result is as it is now
dataSources: [{startBlock: 1}], | |
dataSources: [{startBlock: 1}, {startBlock: 200}], |
const minStartHeight = sortedEvents[0].block; | ||
[...dsMap.entries()].forEach(([height, ds]) => { | ||
if (height >= minStartHeight) dsMap.delete(height); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than deleting, why not look forward to the next project and filter based on that?
@@ -208,6 +208,12 @@ export abstract class BaseBlockDispatcher<Q extends IQueue, DS> implements IBloc | |||
// Flush all data from cache and wait | |||
await this.storeCacheService.flushCache(false, true); | |||
} | |||
|
|||
if (!(await this.projectService.hasDataSourcesAfterHeight(height))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is right. What happens if we run into bypassblocks at the next height?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can do this check with datasources map to make sure we are not exiting prematurely
Docs for review subquery/documentation#443 |
Description
Allow an optional endBlock on the datasource. Handlers in that datasource will only run from startBlock to endBlock
Fixes #2008
Type of change
Please delete options that are not relevant.
Checklist