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

Split token instance fetcher #7286

Merged
merged 8 commits into from Apr 24, 2023
Merged

Conversation

nikitosing
Copy link
Member

@nikitosing nikitosing commented Apr 14, 2023

Close #7024

Changelog

Now 3 fetchers are responsible for fetching token instances:

  • Realtime fetcher:
    • processes token transfers which are not in token_instances table came from Block.Fetchers
    • if token instance fetch successed then token instance added to token_instances table. If not then also added but with some error
  • Retry fetcher:
    • continiously refetches token instances: SELECT * FROM token_instances WHERE error IS NOT NULL
    • if token instance fetch successed then token instance updated. If not then do nothing
  • Sanitize fetcher:
    • once and just after starting the server this fetcher process all the token instances which are not in token_instances table
    • if token instance fetch successed then token instance added to token_instances table. If not then also added but with some error

Remove:

  • INDEXER_TOKEN_INSTANCE_BATCH_SIZE
  • INDEXER_TOKEN_INSTANCE_CONCURRENCY

Add:

  • INDEXER_TOKEN_INSTANCE_RETRY_REFETCH_INTERVAL
  • INDEXER_TOKEN_INSTANCE_RETRY_CONCURRENCY
  • INDEXER_TOKEN_INSTANCE_REALTIME_CONCURRENCY
  • INDEXER_TOKEN_INSTANCE_SANITIZE_CONCURRENCY

blockscout/docs#141

Checklist for your Pull Request (PR)

@nikitosing nikitosing changed the title split token instance fetcher Split token instance fetcher Apr 15, 2023
@nikitosing nikitosing force-pushed the np-split-token-instance-fetcher branch from 12c76a1 to eb6f08e Compare April 15, 2023 11:35
@nikitosing nikitosing force-pushed the np-split-token-instance-fetcher branch from eb6f08e to 745fec3 Compare April 15, 2023 11:36
Copy link
Member

@vbaranov vbaranov left a comment

Choose a reason for hiding this comment

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

I would suggest changing the folders structure and naming of new fetcher's for consistency and reading convenience purposes. Here is the suggestion how to rename new fetchers:

Indexer.Fetcher.Realtime.TokenInstance -> Indexer.Fetcher.TokenInstance.Realtime
Indexer.Fetcher.Retry.TokenInstance -> Indexer.Fetcher.TokenInstance.Retry
Indexer.Fetcher.Sanitize.TokenInstance -> Indexer.Fetcher.TokenInstance.Sanitize
Indexer.Fetcher.TokenInstance -> Indexer.Fetcher.TokenInstance.Helper

And the folder structure like this:
apps/indexer/lib/indexer/fetcher/token_instance:
- realtime.ex
- retry.ex
- sanitize.ex
- helper.ex

@nikitosing nikitosing force-pushed the np-split-token-instance-fetcher branch from 98862a3 to 7ea1863 Compare April 19, 2023 19:24
apps/indexer/lib/indexer/block/fetcher.ex Outdated Show resolved Hide resolved
apps/indexer/lib/indexer/fetcher/token_instance/helper.ex Outdated Show resolved Hide resolved
apps/indexer/lib/indexer/supervisor.ex Outdated Show resolved Hide resolved
@vbaranov vbaranov merged commit 081a275 into master Apr 24, 2023
25 of 26 checks passed
@vbaranov vbaranov deleted the np-split-token-instance-fetcher branch April 24, 2023 09:07
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.

Token instance fetcher: extract realtime and catchup fetchers
3 participants