From 9410a86605616ffe88a0ae3dcd5155b09e4640a0 Mon Sep 17 00:00:00 2001 From: zachdaniel Date: Thu, 18 Oct 2018 12:17:48 -0400 Subject: [PATCH] WIP: application + request coordinator cleanup --- apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/application.ex | 6 ------ .../lib/ethereum_jsonrpc/request_coordinator.ex | 5 ++--- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/application.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/application.ex index 56e69ea36d..2cc8ec0a1a 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/application.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/application.ex @@ -7,12 +7,6 @@ defmodule EthereumJSONRPC.Application do alias EthereumJSONRPC.{RollingWindow, TimeoutCounter, RequestCoordinator} - @rolling_window_opts [ - bucket: :ethereum_jsonrpc_bucket, - window_length: :timer.seconds(10), - window_count: 6 - ] - @impl Application def start(_type, _args) do children = [ diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/request_coordinator.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/request_coordinator.ex index aa7056ac6f..c8a18b9279 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/request_coordinator.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/request_coordinator.ex @@ -29,7 +29,6 @@ defmodule EthereumJSONRPC.RequestCoordinator do waits an amount of time before proceeding based on the count of recent failures. """ - @spec perform(term(), ) def perform(request, named_arguments) do transport = Keyword.fetch!(named_arguments, :transport) transport_options = Keyword.fetch!(named_arguments, :transport_options) @@ -53,12 +52,12 @@ defmodule EthereumJSONRPC.RequestCoordinator do sleep_if_too_many_recent_timeouts(key) - case request(transport, request, transport_options) do + case transport.json_rpc(request, transport_options) do {:error, :timeout} = error -> increment_recent_timeouts(key) if retry? do - request_with_retry(transport, request, transport_options) + request(transport, request, transport_options, true) else error end