Merge pull request #1691 from poanetwork/ab-decrease-token-update-interval

decrease token metadata update interval
pull/1658/head
Ayrat Badykov 6 years ago committed by GitHub
commit 83e229e82a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 2
      apps/indexer/config/config.exs
  3. 7
      apps/indexer/lib/indexer/token/fetcher.ex
  4. 6
      apps/indexer/test/indexer/token/fetcher_test.exs

@ -8,6 +8,7 @@
### Fixes
- [#1669](https://github.com/poanetwork/blockscout/pull/1669) - do not fail if multiple matching tokens are found
- [#1691](https://github.com/poanetwork/blockscout/pull/1691) - decrease token metadata update interval
- [#1688](https://github.com/poanetwork/blockscout/pull/1688) - do not fail if failure reason is atom
- [#1692](https://github.com/poanetwork/blockscout/pull/1692) - exclude decompiled smart contract from encoding

@ -31,7 +31,7 @@ block_transformer =
config :indexer,
block_transformer: block_transformer,
ecto_repos: [Explorer.Repo],
metadata_updater_days_interval: 7,
metadata_updater_days_interval: 2,
# bytes
memory_limit: 1 <<< 30,
first_block: System.get_env("FIRST_BLOCK") || 0

@ -52,11 +52,8 @@ defmodule Indexer.Token.Fetcher do
@decorate trace(name: "fetch", resource: "Indexer.Token.Fetcher.run/2", service: :indexer, tracer: Tracer)
def run([token_contract_address], _json_rpc_named_arguments) do
case Chain.token_from_address_hash(token_contract_address) do
{:ok, %Token{cataloged: false} = token} ->
{:ok, %Token{} = token} ->
catalog_token(token)
{:ok, _} ->
:ok
end
end
@ -74,7 +71,7 @@ defmodule Indexer.Token.Fetcher do
|> MetadataRetriever.get_functions_of()
|> Map.put(:cataloged, true)
{:ok, _} = Chain.update_token(token, token_params)
{:ok, _} = Chain.update_token(%{token | updated_at: DateTime.utc_now()}, token_params)
:ok
end
end

@ -20,12 +20,6 @@ defmodule Indexer.Token.FetcherTest do
end
describe "run/3" do
test "skips tokens that have already been cataloged", %{json_rpc_named_arguments: json_rpc_named_arguments} do
expect(EthereumJSONRPC.Mox, :json_rpc, 0, fn _, _ -> :ok end)
%Token{contract_address_hash: contract_address_hash} = insert(:token, cataloged: true)
assert Fetcher.run([contract_address_hash], json_rpc_named_arguments) == :ok
end
test "catalogs tokens that haven't been cataloged", %{json_rpc_named_arguments: json_rpc_named_arguments} do
token = insert(:token, name: nil, symbol: nil, total_supply: nil, decimals: nil, cataloged: false)
contract_address_hash = token.contract_address_hash

Loading…
Cancel
Save