diff --git a/config/config.exs b/config/config.exs index c785014d8b..a79ee69354 100644 --- a/config/config.exs +++ b/config/config.exs @@ -44,7 +44,8 @@ config :exq, start_on_application: false, scheduler_enable: true, shutdown_timeout: 5000, - max_retries: 10 + max_retries: 10, + queues: [{"default", 1}, {"blocks", 1}, {"transactions", 1}] config :exq_ui, server: false diff --git a/config/dev.exs b/config/dev.exs index 7c56438136..591a96f1ff 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -62,7 +62,4 @@ config :explorer, Explorer.Scheduler, [schedule: {:extended, "*/15 * * * * *"}, task: {Explorer.Workers.ImportSkippedBlocks, :perform_later, [1]}], ] -config :exq, - concurrency: 4 - import_config "dev.secret.exs" diff --git a/config/prod.exs b/config/prod.exs index bef5bd3fc2..51fa32980f 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -54,6 +54,10 @@ config :explorer, Explorer.Scheduler, # Configure Exq config :exq, - concurrency: String.to_integer(System.get_env("EXQ_CONCURRENCY") || "1"), node_identifier: Explorer.ExqNodeIdentifier, - url: System.get_env("REDIS_URL") + url: System.get_env("REDIS_URL"), + queues: [ + {"default", String.to_integer(System.get_env("EXQ_CONCURRENCY") || "1")}, + {"blocks", String.to_integer(System.get_env("EXQ_BLOCKS_CONCURRENCY") || "1")}, + {"transactions", String.to_integer(System.get_env("EXQ_TRANSACTIONS_CONCURRENCY") || "1")} + ] diff --git a/lib/explorer/importers/block_importer.ex b/lib/explorer/importers/block_importer.ex index 2c62e0ab4d..bb734509ee 100644 --- a/lib/explorer/importers/block_importer.ex +++ b/lib/explorer/importers/block_importer.ex @@ -7,6 +7,7 @@ defmodule Explorer.BlockImporter do alias Explorer.Repo.NewRelic, as: Repo alias Explorer.Workers.ImportTransaction + @dialyzer {:nowarn_function, import: 1} def import(block_number) do raw_block = download_block(block_number) changes = extract_block(raw_block) @@ -19,6 +20,7 @@ defmodule Explorer.BlockImporter do import_transactions(raw_block["transactions"]) end + @dialyzer {:nowarn_function, download_block: 1} def download_block(block_number) do {:ok, block} = eth_get_block_by_number(block_number, false) block diff --git a/lib/explorer/workers/import_block.ex b/lib/explorer/workers/import_block.ex index 6a328eec52..d6c68ef3cd 100644 --- a/lib/explorer/workers/import_block.ex +++ b/lib/explorer/workers/import_block.ex @@ -12,10 +12,10 @@ defmodule Explorer.Workers.ImportBlock do def perform, do: perform("latest") def perform_later("latest") do - Exq.enqueue(Exq.Enqueuer, "default", __MODULE__, ["latest"], max_retries: 0) + Exq.enqueue(Exq.Enqueuer, "blocks", __MODULE__, ["latest"], max_retries: 0) end def perform_later(number) do - Exq.enqueue(Exq.Enqueuer, "default", __MODULE__, [number]) + Exq.enqueue(Exq.Enqueuer, "blocks", __MODULE__, [number]) end end diff --git a/lib/explorer/workers/import_transaction.ex b/lib/explorer/workers/import_transaction.ex index 1fee2369d7..fc4241b9b7 100644 --- a/lib/explorer/workers/import_transaction.ex +++ b/lib/explorer/workers/import_transaction.ex @@ -9,6 +9,6 @@ defmodule Explorer.Workers.ImportTransaction do end def perform_later(hash) do - Exq.enqueue(Exq.Enqueuer, "default", __MODULE__, [hash]) + Exq.enqueue(Exq.Enqueuer, "transactions", __MODULE__, [hash]) end end