Skip to content

Commit

Permalink
updating httpoison (#1542)
Browse files Browse the repository at this point in the history
* updating httpoison

* minor plug bump killed the test

* minor plug bump killed the test

* Update ethereum_height_monitor.ex
  • Loading branch information
Ino Murko authored May 29, 2020
1 parent 07774c8 commit f234826
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 37 deletions.
2 changes: 1 addition & 1 deletion apps/omg_child_chain_rpc/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ defmodule OMG.ChildChainRPC.MixProject do
[
{:phoenix, "~> 1.3"},
{:plug_cowboy, "~> 1.0"},
{:httpoison, "~> 1.4.0"},
{:httpoison, "~> 1.6", override: true},
{:cors_plug, "~> 2.0"},
{:spandex_phoenix, "~> 0.4.1"},
{:spandex_datadog, "~> 0.4"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ defmodule OMG.ChildChainRPC.Web.Plugs.MethodParamFilterTest do
conn =
:post
|> conn("/some_endpoint?foo=bar", %{"foo_1" => "bar_1"})
|> Plug.Parsers.call({[:json], [], nil})
|> Plug.Parsers.call({[:json], [], nil, false})
|> MethodParamFilter.call([])

assert conn.body_params == %{"foo_1" => "bar_1"}
Expand All @@ -34,7 +34,7 @@ defmodule OMG.ChildChainRPC.Web.Plugs.MethodParamFilterTest do
conn =
:get
|> conn("/some_endpoint?foo=bar", %{"foo_1" => "bar_1"})
|> Plug.Parsers.call({[:json], [], nil})
|> Plug.Parsers.call({[:json], [], nil, false})
|> MethodParamFilter.call([])

assert conn.body_params == %{}
Expand Down
17 changes: 17 additions & 0 deletions apps/omg_eth/lib/omg_eth/ethereum_height_monitor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,23 @@ defmodule OMG.Eth.EthereumHeightMonitor do
{:noreply, state}
end

# we need to figure out where :sslsocket is getting closed
# because it randomly kills this process and block getter
# https://github.com/omisego/elixir-omg/issues/1529
# https://sentry.io/organizations/omisego/issues/1582175010/?project=1477673
def handle_info({:ssl_closed, {:sslsocket, {:gen_tcp, port, :tls_connection, :undefined}, pids}}, state) do
port_info = Port.info(port)
_ = Logger.error("Getting ssl closed from port #{inspect(port_info)}")

_ =
Enum.map(pids, fn pid ->
process_info = Process.info(pid)
_ = Logger.error("Affected pids #{inspect(process_info)}")
end)

{:stop, :killed_by_ssl_closed, state}
end

def handle_info(:check_new_height, state) do
height = fetch_height(state.eth_module)
stalled? = stalled?(height, state.ethereum_height, state.synced_at, state.stall_threshold_ms)
Expand Down
3 changes: 1 addition & 2 deletions apps/omg_eth/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ defmodule OMG.Eth.MixProject do
{:omg_db, in_umbrella: true},
# TEST ONLY
{:exexec, git: "https://github.com/pthomalla/exexec.git", branch: "add_streams", only: [:dev, :test]},
{:briefly, "~> 0.3.0", only: [:dev, :test]},
{:exvcr, "~> 0.10", only: :test}
{:briefly, "~> 0.3.0", only: [:dev, :test]}
]
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,25 @@ defmodule OMG.WatcherRPC.Web.Plugs.MethodParamFilterTest do

alias OMG.WatcherRPC.Web.Plugs.MethodParamFilter

# this test seems like it's reaching far to deep into internals of plugs
test "filters query params for POST" do
conn =
:post
|> conn("/some_endpoint?foo=bar", %{"foo_1" => "bar_1"})
|> Plug.Parsers.call({[:json], [], nil})
|> Plug.Parsers.call({[:json], [], nil, false})
|> MethodParamFilter.call([])

assert conn.body_params == %{"foo_1" => "bar_1"}
assert conn.query_params == %{}
assert conn.params == %{"foo_1" => "bar_1"}
end

# this test seems like it's reaching far to deep into internals of plugs
test "filters body params for GET" do
conn =
:get
|> conn("/some_endpoint?foo=bar", %{"foo_1" => "bar_1"})
|> Plug.Parsers.call({[:json], [], nil})
|> Plug.Parsers.call({[:json], [], nil, false})
|> MethodParamFilter.call([])

assert conn.body_params == %{}
Expand Down
2 changes: 1 addition & 1 deletion docs/source_consumption_log.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ exexec 0.1.0 -> Apache 2.0
exth_crypto 0.1.4 -> MIT
fake_server 1.5.0 -> Apache 2.0
hackney 1.15.1 -> Apache 2
httpoison 1.4.0 -> MIT
httpoison 1.6.0 -> MIT
idna 5.1.1 -> BSD
keccakf1600 2.0.0 -> MPL 2.0 (ok'd by legal, compliant with our Apache 2.0)
libsecp256k1 0.1.9 -> MIT
Expand Down
Loading

0 comments on commit f234826

Please sign in to comment.