|
|
@ -5,7 +5,7 @@ defmodule EthereumJSONRPC.Application do |
|
|
|
|
|
|
|
|
|
|
|
use Application |
|
|
|
use Application |
|
|
|
|
|
|
|
|
|
|
|
alias EthereumJSONRPC.{RequestCoordinator, RollingWindow} |
|
|
|
alias EthereumJSONRPC.{IPC, RequestCoordinator, RollingWindow} |
|
|
|
|
|
|
|
|
|
|
|
@impl Application |
|
|
|
@impl Application |
|
|
|
def start(_type, _args) do |
|
|
|
def start(_type, _args) do |
|
|
@ -17,6 +17,7 @@ defmodule EthereumJSONRPC.Application do |
|
|
|
:hackney_pool.child_spec(:ethereum_jsonrpc, recv_timeout: 60_000, timeout: 60_000, max_connections: 1000), |
|
|
|
:hackney_pool.child_spec(:ethereum_jsonrpc, recv_timeout: 60_000, timeout: 60_000, max_connections: 1000), |
|
|
|
Supervisor.child_spec({RollingWindow, [rolling_window_opts]}, id: RollingWindow.ErrorThrottle) |
|
|
|
Supervisor.child_spec({RollingWindow, [rolling_window_opts]}, id: RollingWindow.ErrorThrottle) |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|> add_ipc_client() |
|
|
|
|> add_throttle_rolling_window(config) |
|
|
|
|> add_throttle_rolling_window(config) |
|
|
|
|> Supervisor.start_link(strategy: :one_for_one, name: EthereumJSONRPC.Supervisor) |
|
|
|
|> Supervisor.start_link(strategy: :one_for_one, name: EthereumJSONRPC.Supervisor) |
|
|
|
end |
|
|
|
end |
|
|
@ -37,4 +38,11 @@ defmodule EthereumJSONRPC.Application do |
|
|
|
children |
|
|
|
children |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defp add_ipc_client(children) do |
|
|
|
|
|
|
|
case Application.get_env(:ethereum_jsonrpc, :rpc_transport) do |
|
|
|
|
|
|
|
:ipc -> [IPC.child_spec([path: Application.get_env(:ethereum_jsonrpc, :ipc_path)]) | children] |
|
|
|
|
|
|
|
_ -> children |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|