diff --git a/apps/block_scout_web/config/runtime/test.exs b/apps/block_scout_web/config/runtime/test.exs index a83f9dd0eb..6653c17ab6 100644 --- a/apps/block_scout_web/config/runtime/test.exs +++ b/apps/block_scout_web/config/runtime/test.exs @@ -2,6 +2,7 @@ import Config alias EthereumJSONRPC.Variant +config :ethereum_jsonrpc, EthereumJSONRPC.Utility.EndpointAvailabilityChecker, enabled: false config :explorer, Explorer.ExchangeRates, enabled: false, store: :none config :ueberauth, Ueberauth.Strategy.Auth0.OAuth, diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/utility/endpoint_availability_checker.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/utility/endpoint_availability_checker.ex index 45f2f687d8..2f1c1fdb3f 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/utility/endpoint_availability_checker.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/utility/endpoint_availability_checker.ex @@ -16,9 +16,13 @@ defmodule EthereumJSONRPC.Utility.EndpointAvailabilityChecker do end def init(_) do - schedule_next_check() + if Application.get_env(:ethereum_jsonrpc, __MODULE__)[:enabled] do + schedule_next_check() - {:ok, %{unavailable_endpoints_arguments: []}} + {:ok, %{unavailable_endpoints_arguments: []}} + else + :ignore + end end def add_endpoint(json_rpc_named_arguments, url_type) do diff --git a/config/runtime.exs b/config/runtime.exs index 49bd6a6f71..4ba4f097b3 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -200,6 +200,8 @@ config :ethereum_jsonrpc, EthereumJSONRPC.PendingTransaction, config :ethereum_jsonrpc, EthereumJSONRPC.RequestCoordinator, wait_per_timeout: ConfigHelper.parse_time_env_var("ETHEREUM_JSONRPC_WAIT_PER_TIMEOUT", "20s") +config :ethereum_jsonrpc, EthereumJSONRPC.Utility.EndpointAvailabilityChecker, enabled: true + ################ ### Explorer ### ################