Skip to content

Commit

Permalink
Merge pull request #2906 from poanetwork/ab-fix-address-sum-cache1
Browse files Browse the repository at this point in the history
restart cache for tests
  • Loading branch information
vbaranov committed Dec 7, 2019
2 parents bd7b367 + a5b83cd commit da54650
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Features

### Fixes
- [#2906](https://github.com/poanetwork/blockscout/pull/2906) - fix address sum cache

- [#2902](https://github.com/poanetwork/blockscout/pull/2902) - Offset in blocks retrieval for average block time

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ defmodule BlockScoutWeb.API.RPC.StatsControllerTest do
|> get("/api", params)
|> json_response(200)

assert response["result"] == "6"
assert response["result"] == "0"
assert response["status"] == "1"
assert response["message"] == "OK"
assert :ok = ExJsonSchema.Validator.validate(ethsupply_schema(), response)
Expand Down
2 changes: 1 addition & 1 deletion apps/explorer/lib/explorer/chain.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2922,7 +2922,7 @@ defmodule Explorer.Chain do
"""
@spec total_supply :: non_neg_integer() | nil
def total_supply do
supply_module().total()
supply_module().total() || 0
end

@doc """
Expand Down
2 changes: 1 addition & 1 deletion apps/explorer/lib/explorer/chain/cache/address_sum.ex
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defmodule Explorer.Chain.Cache.AddressSum do
# See next `handle_fallback` definition
get_async_task()

{:return, nil}
{:return, Decimal.new(0)}
end

defp handle_fallback(:async_task) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defmodule Explorer.Chain.Cache.AddressSumTest do
test "returns default address sum" do
result = AddressSum.get_sum()

assert is_nil(result)
assert result == Decimal.new(0)
end

test "updates cache if initial value is zero" do
Expand Down

0 comments on commit da54650

Please sign in to comment.