From a1817f4148ad163ceabfde00fff854f0a4bc1a8e Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 9 Jul 2024 14:26:13 +0300 Subject: [PATCH] Fix missing expectation in mock_beacon_storage_pointer_request (#10399) * Fix missing expectation in mock_beacon_storage_pointer_request * Update apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/utility/endpoint_availability_checker.ex Co-authored-by: Qwerty5Uiop <105209995+Qwerty5Uiop@users.noreply.github.com> --------- Co-authored-by: Qwerty5Uiop <105209995+Qwerty5Uiop@users.noreply.github.com> --- apps/block_scout_web/config/runtime/test.exs | 1 + .../utility/endpoint_availability_checker.ex | 8 ++++++-- config/runtime.exs | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) 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 ### ################