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 last value of fetched coinsupply API endpoint from DB if cache is empty #3134

Merged
merged 2 commits into from
May 27, 2020

Conversation

vbaranov
Copy link
Member

@vbaranov vbaranov commented May 27, 2020

Motivation

coinsupply API endpoint returns 0 supply for sometime after restart of the application because it retrieved from ETS (in-memory cache), which is cleared on application restart.

Changelog

In order to provide uninterrupted service for coinsupply API endpoint, it is suggested to store last fetched value on cache update for this counter in the DB. And if cache is empty (for instance, on application restart), get that value from DB.

Checklist for your Pull Request (PR)

@vbaranov vbaranov self-assigned this May 27, 2020
@vbaranov vbaranov changed the title Last values of fetched coinsupply from DB if cache is empty Last value of fetched coinsupply from DB if cache is empty May 27, 2020
@vbaranov vbaranov changed the title Last value of fetched coinsupply from DB if cache is empty Get last value of fetched coinsupply API endpoint from DB if cache is empty May 27, 2020
@vbaranov vbaranov force-pushed the vb-last-fetched-counters-in-db branch from 9d04fa7 to 0e20429 Compare May 27, 2020 16:58
@coveralls
Copy link

coveralls commented May 27, 2020

Pull Request Test Coverage Report for Build 8887eef5-439a-404a-94a3-2148153cace5

  • 0 of 11 (0.0%) changed or added relevant lines in 4 files are covered.
  • 8 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.2%) to 74.912%

Changes Missing Coverage Covered Lines Changed/Added Lines %
apps/explorer/lib/explorer/chain/cache/address_sum_minus_burnt.ex 0 2 0.0%
apps/explorer/lib/explorer/counters/last_fetched_counter.ex 0 2 0.0%
apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/stats_controller.ex 0 3 0.0%
apps/explorer/lib/explorer/chain.ex 0 4 0.0%
Files with Coverage Reduction New Missed Lines %
apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/stats_controller.ex 1 60.0%
apps/explorer/lib/explorer/chain/cache/address_sum_minus_burnt.ex 1 0%
apps/block_scout_web/lib/block_scout_web/checksum_address.ex 6 55.56%
Totals Coverage Status
Change from base Build 778b42fc-02a4-4875-9253-a23897f27ebd: -0.2%
Covered Lines: 5718
Relevant Lines: 7633

💛 - Coveralls

@vbaranov vbaranov merged commit 9ccbd3a into master May 27, 2020
@vbaranov vbaranov deleted the vb-last-fetched-counters-in-db branch May 27, 2020 21:14
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.

None yet

2 participants