fix: race condition in cache tests (#10441)

kf-fix-code-compiler-test
Kirill Fedoseev 4 months ago committed by GitHub
parent 168067cff7
commit 6f8b48f2c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      apps/explorer/lib/explorer/chain/cache/address_sum.ex
  2. 2
      apps/explorer/lib/explorer/chain/cache/address_sum_minus_burnt.ex
  3. 8
      apps/explorer/lib/explorer/chain/cache/background_migrations.ex
  4. 2
      apps/explorer/lib/explorer/chain/cache/block.ex
  5. 2
      apps/explorer/lib/explorer/chain/cache/gas_price_oracle.ex
  6. 2
      apps/explorer/lib/explorer/chain/cache/gas_usage.ex
  7. 2
      apps/explorer/lib/explorer/chain/cache/pending_block_operation.ex
  8. 2
      apps/explorer/lib/explorer/chain/cache/transaction.ex
  9. 2
      apps/explorer/lib/explorer/chain/ordered_cache.ex
  10. 2
      apps/explorer/test/explorer/chain/cache/block_test.exs
  11. 2
      apps/explorer/test/explorer/chain/cache/transaction_test.exs

@ -28,7 +28,7 @@ defmodule Explorer.Chain.Cache.AddressSum do
# If this gets called it means an async task was requested, but none exists
# so a new one needs to be launched
{:ok, task} =
Task.start(fn ->
Task.start_link(fn ->
try do
result = Etherscan.fetch_sum_coin_total_supply()

@ -28,7 +28,7 @@ defmodule Explorer.Chain.Cache.AddressSumMinusBurnt do
# If this gets called it means an async task was requested, but none exists
# so a new one needs to be launched
{:ok, task} =
Task.start(fn ->
Task.start_link(fn ->
try do
result = Etherscan.fetch_sum_coin_total_supply_minus_burnt()

@ -22,7 +22,7 @@ defmodule Explorer.Chain.Cache.BackgroundMigrations do
}
defp handle_fallback(:transactions_denormalization_finished) do
Task.start(fn ->
Task.start_link(fn ->
set_transactions_denormalization_finished(TransactionsDenormalization.migration_finished?())
end)
@ -30,7 +30,7 @@ defmodule Explorer.Chain.Cache.BackgroundMigrations do
end
defp handle_fallback(:tb_token_type_finished) do
Task.start(fn ->
Task.start_link(fn ->
set_tb_token_type_finished(AddressTokenBalanceTokenType.migration_finished?())
end)
@ -38,7 +38,7 @@ defmodule Explorer.Chain.Cache.BackgroundMigrations do
end
defp handle_fallback(:ctb_token_type_finished) do
Task.start(fn ->
Task.start_link(fn ->
set_ctb_token_type_finished(AddressCurrentTokenBalanceTokenType.migration_finished?())
end)
@ -46,7 +46,7 @@ defmodule Explorer.Chain.Cache.BackgroundMigrations do
end
defp handle_fallback(:tt_denormalization_finished) do
Task.start(fn ->
Task.start_link(fn ->
set_tt_denormalization_finished(TokenTransferTokenType.migration_finished?())
end)

@ -67,7 +67,7 @@ defmodule Explorer.Chain.Cache.Block do
# If this gets called it means an async task was requested, but none exists
# so a new one needs to be launched
{:ok, task} =
Task.start(fn ->
Task.start_link(fn ->
try do
result = fetch_count_consensus_block()

@ -321,7 +321,7 @@ defmodule Explorer.Chain.Cache.GasPriceOracle do
# If this gets called it means an async task was requested, but none exists
# so a new one needs to be launched
{:ok, task} =
Task.start(fn ->
Task.start_link(fn ->
try do
{result, acc} = get_average_gas_price(num_of_blocks(), safelow(), average(), fast())

@ -49,7 +49,7 @@ defmodule Explorer.Chain.Cache.GasUsage do
# If this gets called it means an async task was requested, but none exists
# so a new one needs to be launched
{:ok, task} =
Task.start(fn ->
Task.start_link(fn ->
try do
result = fetch_sum_gas_used()

@ -46,7 +46,7 @@ defmodule Explorer.Chain.Cache.PendingBlockOperation do
# If this gets called it means an async task was requested, but none exists
# so a new one needs to be launched
{:ok, task} =
Task.start(fn ->
Task.start_link(fn ->
try do
result = Repo.aggregate(PendingBlockOperation, :count, timeout: :infinity)

@ -47,7 +47,7 @@ defmodule Explorer.Chain.Cache.Transaction do
# If this gets called it means an async task was requested, but none exists
# so a new one needs to be launched
{:ok, task} =
Task.start(fn ->
Task.start_link(fn ->
try do
result = Repo.aggregate(Transaction, :count, :hash, timeout: :infinity)

@ -290,7 +290,7 @@ defmodule Explorer.Chain.OrderedCache do
# Different updates cannot interfere with the removed element because
# if this was scheduled for removal it means it is too old, so following
# updates cannot insert it in the future.
Task.start(fn ->
Task.start_link(fn ->
Process.sleep(100)
if is_list(key) do

@ -22,7 +22,7 @@ defmodule Explorer.Chain.Cache.BlockTest do
_result = Block.get_count()
Process.sleep(2000)
Process.sleep(1000)
updated_value = Block.get_count()

@ -22,7 +22,7 @@ defmodule Explorer.Chain.Cache.TransactionTest do
_result = Transaction.get_count()
Process.sleep(2000)
Process.sleep(1000)
updated_value = Transaction.get_count()

Loading…
Cancel
Save