Skip to content

Commit

Permalink
Resolve outdated cache
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmanzanera committed Dec 19, 2024
1 parent cea0973 commit 0b82c22
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion lib/archethic_web/explorer/live/chains/beacon_chain_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,17 @@ defmodule ArchethicWeb.Explorer.BeaconChainLive do
list_transactions_from_summaries(date)
end)

transactions =
case transactions do
[] ->
date
|> list_transactions_from_summaries()
|> tap(fn txs -> TransactionCache.put(date, txs) end)

txs ->
txs
end

new_assign =
socket
|> assign(:fetching, false)
Expand All @@ -122,9 +133,20 @@ defmodule ArchethicWeb.Explorer.BeaconChainLive do
# Try to fetch from the cache, other fetch from the beacon aggregate
{:ok, transactions} =
TransactionCache.resolve(date, fn ->
list_transactions_from_aggregate(date)
list_transactions_from_aggregate(date) |> IO.inspect()

Check warning on line 136 in lib/archethic_web/explorer/live/chains/beacon_chain_live.ex

View workflow job for this annotation

GitHub Actions / Build and test

There should be no calls to IO.inspect/1.
end)

transactions =
case transactions do
[] ->
date
|> list_transactions_from_aggregate()
|> tap(fn txs -> TransactionCache.put(date, txs) end)

txs ->
txs
end

new_assign =
socket
|> assign(:fetching, false)
Expand Down

0 comments on commit 0b82c22

Please sign in to comment.