Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove unused ets tables #804

Merged
merged 1 commit into from
Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions lib/ae_mdw/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,6 @@ defmodule AeMdw.Application do

defp init(:tables) do
:ets.new(:tx_sync_cache, [:named_table, :ordered_set, :public])
:ets.new(:name_sync_cache, [:named_table, :ordered_set, :public])
:ets.new(:oracle_sync_cache, [:named_table, :ordered_set, :public])
:ets.new(:ct_create_sync_cache, [:named_table, :set, :public])
:ets.new(:aex9_sync_cache, [:named_table, :set, :public])
:ets.new(:stat_sync_cache, [:named_table, :ordered_set, :public])

AeMdw.Sync.AsyncTasks.Stats.init()
AeMdw.Sync.AsyncTasks.Store.init()
Expand Down
8 changes: 0 additions & 8 deletions test/ae_mdw/db/mutations/stats_mutation_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ defmodule AeMdw.Db.StatsMutationTest do
height = 300

on_exit(fn ->
AeMdw.Ets.clear(:stat_sync_cache)
Database.dirty_delete(Model.DeltaStat, height)
Database.dirty_delete(Model.TotalStat, height)
end)
Expand Down Expand Up @@ -72,7 +71,6 @@ defmodule AeMdw.Db.StatsMutationTest do
height = 300

on_exit(fn ->
AeMdw.Ets.clear(:stat_sync_cache)
Database.dirty_delete(Model.DeltaStat, height)
Database.dirty_delete(Model.TotalStat, height)
end)
Expand Down Expand Up @@ -124,10 +122,6 @@ defmodule AeMdw.Db.StatsMutationTest do
end

test "when there's names activated on the cache, it grabs it to store the stats" do
on_exit(fn ->
AeMdw.Ets.clear(:stat_sync_cache)
end)

height = 300
dev_amount = 50
block_amount = 120
Expand Down Expand Up @@ -194,8 +188,6 @@ defmodule AeMdw.Db.StatsMutationTest do

describe "execute/2" do
test "with all_cached? = false, on 1st block reward it stores the stat using database counts" do
AeMdw.Ets.clear(:stat_sync_cache)

height = 21
mutation = StatsMutation.new(height, false)

Expand Down
12 changes: 5 additions & 7 deletions test/ae_mdw/db/sync/transaction_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ defmodule AeMdw.Db.Sync.TransactionTest do
mb_events = %{}

# setup contract
contract_pk = setup_contract_on_call(signed_tx, txi)
contract_pk = setup_contract_on_call(signed_tx)
aex9_meta_info = {"TestAEX9-B vs TestAEX9-A", "TAEX9-B/TAEX9-A", 18}
child_contract_pk = Validate.id!(fun_args_res("create_pair")[:result][:value])

Expand Down Expand Up @@ -159,7 +159,7 @@ defmodule AeMdw.Db.Sync.TransactionTest do
mb_events = %{}

# setup contract
contract_pk = setup_contract_on_create(signed_tx, txi)
contract_pk = setup_contract_on_create(signed_tx)
number = abs(System.unique_integer())
aex141_meta_info = {"test-nft#{number}", "test-nft#{number}", "http://some-fake-url", :url}

Expand Down Expand Up @@ -219,7 +219,7 @@ defmodule AeMdw.Db.Sync.TransactionTest do
mb_events = %{}

# setup contract
contract_pk = setup_contract_on_create(signed_tx, txi)
contract_pk = setup_contract_on_create(signed_tx)
aex141_meta_info = {:error, :error, nil, nil}

with_mocks [
Expand Down Expand Up @@ -273,10 +273,9 @@ defmodule AeMdw.Db.Sync.TransactionTest do
#
# Helper functions
#
defp setup_contract_on_call(signed_tx, txi) do
defp setup_contract_on_call(signed_tx) do
{_mod, tx} = :aetx.specialize_callback(:aetx_sign.tx(signed_tx))
contract_pk = :aect_call_tx.contract_pubkey(tx)
:ets.insert(:ct_create_sync_cache, {contract_pk, txi - 1})

functions =
%{
Expand All @@ -290,10 +289,9 @@ defmodule AeMdw.Db.Sync.TransactionTest do
contract_pk
end

defp setup_contract_on_create(signed_tx, create_txi) do
defp setup_contract_on_create(signed_tx) do
{_mod, tx} = :aetx.specialize_callback(:aetx_sign.tx(signed_tx))
contract_pk = :aect_create_tx.contract_pubkey(tx)
:ets.insert(:ct_create_sync_cache, {contract_pk, create_txi})

functions =
@aex141_mint_signature
Expand Down