|
|
|
@ -17,9 +17,10 @@ defmodule Explorer.Chain.Cache.AddressSumMinusBurnt do |
|
|
|
|
alias Explorer.Chain.Cache.Helper |
|
|
|
|
|
|
|
|
|
defp handle_fallback(:sum_minus_burnt) do |
|
|
|
|
# This will get the task PID if one exists and launch a new task if not |
|
|
|
|
# This will get the task PID if one exists, check if it's running and launch |
|
|
|
|
# a new task if task doesn't exist or it's not running. |
|
|
|
|
# See next `handle_fallback` definition |
|
|
|
|
get_async_task() |
|
|
|
|
safe_get_async_task() |
|
|
|
|
|
|
|
|
|
{:return, Decimal.new(0)} |
|
|
|
|
end |
|
|
|
@ -56,7 +57,7 @@ defmodule Explorer.Chain.Cache.AddressSumMinusBurnt do |
|
|
|
|
|
|
|
|
|
# By setting this as a `callback` an async task will be started each time the |
|
|
|
|
# `sum_minus_burnt` expires (unless there is one already running) |
|
|
|
|
defp async_task_on_deletion({:delete, _, :sum_minus_burnt}), do: get_async_task() |
|
|
|
|
defp async_task_on_deletion({:delete, _, :sum_minus_burnt}), do: safe_get_async_task() |
|
|
|
|
|
|
|
|
|
defp async_task_on_deletion(_data), do: nil |
|
|
|
|
end |
|
|
|
|