|
|
@ -25,13 +25,8 @@ defmodule Indexer.Fetcher.BlockReward do |
|
|
|
|
|
|
|
|
|
|
|
@behaviour BufferedTask |
|
|
|
@behaviour BufferedTask |
|
|
|
|
|
|
|
|
|
|
|
@defaults [ |
|
|
|
@default_max_batch_size 10 |
|
|
|
flush_interval: :timer.seconds(3), |
|
|
|
@default_max_concurrency 4 |
|
|
|
max_batch_size: 10, |
|
|
|
|
|
|
|
max_concurrency: 4, |
|
|
|
|
|
|
|
task_supervisor: Indexer.Fetcher.BlockReward.TaskSupervisor, |
|
|
|
|
|
|
|
metadata: [fetcher: :block_reward] |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@doc """ |
|
|
|
@doc """ |
|
|
|
Asynchronously fetches block rewards for each `t:Explorer.Chain.Explorer.block_number/0`` in `block_numbers`. |
|
|
|
Asynchronously fetches block rewards for each `t:Explorer.Chain.Explorer.block_number/0`` in `block_numbers`. |
|
|
@ -57,7 +52,7 @@ defmodule Indexer.Fetcher.BlockReward do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
merged_init_options = |
|
|
|
merged_init_options = |
|
|
|
@defaults |
|
|
|
defaults() |
|
|
|
|> Keyword.merge(mergeable_init_options) |
|
|
|
|> Keyword.merge(mergeable_init_options) |
|
|
|
|> Keyword.put(:state, state) |
|
|
|
|> Keyword.put(:state, state) |
|
|
|
|
|
|
|
|
|
|
@ -337,4 +332,14 @@ defmodule Indexer.Fetcher.BlockReward do |
|
|
|
when is_integer(code) and is_binary(message) and is_binary(block_quantity) do |
|
|
|
when is_integer(code) and is_binary(message) and is_binary(block_quantity) do |
|
|
|
["@", quantity_to_integer(block_quantity), ": (", to_string(code), ") ", message, ?\n] |
|
|
|
["@", quantity_to_integer(block_quantity), ": (", to_string(code), ") ", message, ?\n] |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defp defaults do |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
flush_interval: :timer.seconds(3), |
|
|
|
|
|
|
|
max_concurrency: Application.get_env(:indexer, __MODULE__)[:concurrency] || @default_max_concurrency, |
|
|
|
|
|
|
|
max_batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_max_batch_size, |
|
|
|
|
|
|
|
task_supervisor: Indexer.Fetcher.BlockReward.TaskSupervisor, |
|
|
|
|
|
|
|
metadata: [fetcher: :block_reward] |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|