@ -1871,7 +1871,7 @@ defmodule Explorer.Chain do
def transaction_estimated_count do
cached_value = TransactionCountCache.value()
if cached_value == 0 do
if is_nil(cached_value) do
%Postgrex.Result{rows: [[rows]]} =
SQL.query!(Repo, "SELECT reltuples::BIGINT AS estimate FROM pg_class WHERE relname='transactions'")
@ -12,7 +12,7 @@ defmodule Explorer.Chain.TransactionCountCache do
# 2 hours
@cache_period 1_000 * 60 * 60 * 2
@default_value 0
@default_value nil
@key "count"
@name __MODULE__
@ -8,7 +8,7 @@ defmodule Explorer.Chain.TransactionCountCacheTest do
result = TransactionCountCache.value(TestCache)
assert result == 0
assert is_nil(result)
end
test "updates cache if initial value is zero" do