Fix credo and format issues

pull/1095/head
William Sanches 6 years ago
parent 2df87c2cd1
commit 421262a2da
No known key found for this signature in database
GPG Key ID: 27250E49FB133014
  1. 2
      apps/explorer/lib/explorer/chain.ex
  2. 2
      apps/explorer/lib/explorer/chain/token.ex
  3. 2
      apps/explorer/test/explorer/chain_test.exs
  4. 7
      apps/indexer/lib/indexer/token/metadata_updater.ex
  5. 1
      apps/indexer/lib/indexer/token/supervisor.ex

@ -1951,7 +1951,7 @@ defmodule Explorer.Chain do
Repo.transaction(
fn ->
Chain.Token.cataloged_tokens()
|> Ecto.Query.order_by([asc: :updated_at])
|> order_by(asc: :updated_at)
|> Repo.stream(timeout: :infinity)
|> Enum.reduce(initial_acc, reducer)
end,

@ -100,7 +100,7 @@ defmodule Explorer.Chain.Token do
These are tokens with cataloged field set to true.
"""
def cataloged_tokens() do
def cataloged_tokens do
from(
token in __MODULE__,
select: token.contract_address_hash,

@ -2773,7 +2773,7 @@ defmodule Explorer.ChainTest do
expected_response =
[token1, token2]
|> Enum.sort(&(&1.updated_at < &2.updated_at))
|> Enum.map(&(&1.contract_address_hash))
|> Enum.map(& &1.contract_address_hash)
assert Chain.stream_cataloged_token_contract_address_hashes([], &(&2 ++ [&1])) == {:ok, expected_response}
end

@ -22,8 +22,11 @@ defmodule Indexer.Token.MetadataUpdater do
@impl true
def handle_info(:update_tokens, state) do
{:ok, tokens} = Chain.stream_cataloged_token_contract_address_hashes([], &(&2 ++ [&1]))
update_metadata(tokens)
{:ok, tokens} = Chain.stream_cataloged_token_contract_address_hashes([], &[&1 | &2])
tokens
|> Enum.reverse()
|> update_metadata()
Process.send_after(self(), :update_tokens, :timer.hours(state.update_interval) * 24)

@ -28,6 +28,7 @@ defmodule Indexer.Token.Supervisor do
@impl Supervisor
def init(fetcher_arguments) do
metadata_updater_inverval = Application.get_env(:indexer, :metadata_updater_days_interval)
Supervisor.init(
[
{Task.Supervisor, name: Indexer.Token.TaskSupervisor},

Loading…
Cancel
Save