Skip to content

Commit

Permalink
Exit transformer on target process exit
Browse files Browse the repository at this point in the history
  • Loading branch information
chazsconi committed Sep 26, 2019
1 parent 2b38e8f commit 0bbb1b3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/httpoison/base.ex
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,9 @@ defmodule HTTPoison.Base do
process_response_headers,
process_response_chunk
) do
# Track the target process so we can exit when it dies
Process.monitor(target)

receive do
{:hackney_response, id, {:status, code, _reason}} ->
send(target, %HTTPoison.AsyncStatus{id: id, code: process_response_status_code.(code)})
Expand Down Expand Up @@ -622,6 +625,10 @@ defmodule HTTPoison.Base do
process_response_headers,
process_response_chunk
)

# Exit if the target process dies as this will be a zombie
{:DOWN, _ref, :process, ^target, _reason} ->
:ok
end
end

Expand Down

0 comments on commit 0bbb1b3

Please sign in to comment.