WIP: application + request coordinator cleanup

pull/961/head
zachdaniel 6 years ago committed by Luke Imhoff
parent 961a2fb03c
commit 9410a86605
  1. 6
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/application.ex
  2. 5
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/request_coordinator.ex

@ -7,12 +7,6 @@ defmodule EthereumJSONRPC.Application do
alias EthereumJSONRPC.{RollingWindow, TimeoutCounter, RequestCoordinator} alias EthereumJSONRPC.{RollingWindow, TimeoutCounter, RequestCoordinator}
@rolling_window_opts [
bucket: :ethereum_jsonrpc_bucket,
window_length: :timer.seconds(10),
window_count: 6
]
@impl Application @impl Application
def start(_type, _args) do def start(_type, _args) do
children = [ children = [

@ -29,7 +29,6 @@ defmodule EthereumJSONRPC.RequestCoordinator do
waits an amount of time before proceeding based on the count of recent waits an amount of time before proceeding based on the count of recent
failures. failures.
""" """
@spec perform(term(), )
def perform(request, named_arguments) do def perform(request, named_arguments) do
transport = Keyword.fetch!(named_arguments, :transport) transport = Keyword.fetch!(named_arguments, :transport)
transport_options = Keyword.fetch!(named_arguments, :transport_options) transport_options = Keyword.fetch!(named_arguments, :transport_options)
@ -53,12 +52,12 @@ defmodule EthereumJSONRPC.RequestCoordinator do
sleep_if_too_many_recent_timeouts(key) 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 -> {:error, :timeout} = error ->
increment_recent_timeouts(key) increment_recent_timeouts(key)
if retry? do if retry? do
request_with_retry(transport, request, transport_options) request(transport, request, transport_options, true)
else else
error error
end end

Loading…
Cancel
Save