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

Remove duplicate params in Indexer.Fetcher.TokenBalance #2270

Merged
merged 2 commits into from
Jul 1, 2019

Conversation

pasqu4le
Copy link
Contributor

Motivation

Explorer.Chain.Import.Runner.Address.TokenBalances fails with the cardinality_violation error because it tries to insert more than once token balances (for the same {token_contract_address_hash, address_hash, block_number} tuple) in a single database transaction.

Changelog

Bug Fixes

This PR filters out duplicate parameters in Indexer.Fetcher.TokenBalance so that no duplicates are sent to be imported.

Checklist for your PR

  • I added an entry to CHANGELOG.md with this PR
  • If I added new functionality, I added tests covering it.
  • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • I checked whether I should update the docs and did so if necessary

@pasqu4le pasqu4le added the ready for review This PR is ready for reviews. label Jun 28, 2019
@pasqu4le pasqu4le self-assigned this Jun 28, 2019
Problem: `Explorer.Chain.Import.Runner.Address.TokenBalances` fails with the `cardinality_violation` error because it tries to insert more than once token balances (for the same {token_contract_address_hash, address_hash, block_number} tuple) in a single database transaction.

Solution: filter out duplicate parameters in `Indexer.Fetcher.TokenBalance` so that no duplicates are sent to be imported.
@pasqu4le pasqu4le force-pushed the pp-dedup-params-in-token_balance-fetcher branch from cd40eb2 to 144f39d Compare June 28, 2019 15:17
@coveralls
Copy link

coveralls commented Jun 28, 2019

Pull Request Test Coverage Report for Build f4d1f5d1-ae59-4b42-bf87-0c78e3aa06e4

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • 4 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.04%) to 81.177%

Files with Coverage Reduction New Missed Lines %
apps/indexer/lib/indexer/block/catchup/fetcher.ex 4 69.23%
Totals Coverage Status
Change from base Build 04c0188e-e6c7-455d-973d-a065342f98f0: 0.04%
Covered Lines: 5119
Relevant Lines: 6306

💛 - Coveralls

vbaranov pushed a commit that referenced this pull request Jul 1, 2019
@vbaranov vbaranov merged commit aa84f2e into master Jul 1, 2019
@vbaranov vbaranov deleted the pp-dedup-params-in-token_balance-fetcher branch July 1, 2019 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review This PR is ready for reviews.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants