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

Get estimated count of blocks when cache is empty #2002

Merged
merged 3 commits into from
May 22, 2019

Conversation

saneery
Copy link
Contributor

@saneery saneery commented May 22, 2019

Motivation

Replace block_consensus_count function with an estimated count of blocks when the cache is empty.
Get 90% of the estimated count, because consensus blocks are ~90% of the total count.

@saneery saneery added the ready for review This PR is ready for reviews. label May 22, 2019
@coveralls
Copy link

coveralls commented May 22, 2019

Pull Request Test Coverage Report for Build b28c70cd-417c-4911-8ede-ff5e1b76ee5d

  • 0 of 2 (0.0%) changed or added relevant lines in 1 file are covered.
  • 6 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.1%) to 81.105%

Changes Missing Coverage Covered Lines Changed/Added Lines %
apps/explorer/lib/explorer/chain.ex 0 2 0.0%
Files with Coverage Reduction New Missed Lines %
apps/indexer/lib/indexer/fetcher/token.ex 1 78.57%
apps/indexer/lib/indexer/fetcher/token_balance.ex 2 87.1%
apps/indexer/lib/indexer/block/fetcher.ex 3 87.84%
Totals Coverage Status
Change from base Build 5282fa36-26ca-4d21-9379-4240277bab9f: -0.1%
Covered Lines: 4713
Relevant Lines: 5811

💛 - Coveralls

@@ -1997,7 +1997,9 @@ defmodule Explorer.Chain do
cached_value = BlockCountCache.count()

if is_nil(cached_value) do
block_consensus_count()
Copy link
Member

Choose a reason for hiding this comment

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

@saneery should we remove or mark with the comment, that block_consensus_count function is not used anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I think, we can just remove this function

@vbaranov vbaranov merged commit 5fa2dd6 into master May 22, 2019
@vbaranov vbaranov deleted the estimated-consensus-block branch May 22, 2019 18:26
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.

5 participants