Skip to content

Commit

Permalink
Merge pull request #395 from chazsconi/exit-transformer-on-target-exit
Browse files Browse the repository at this point in the history
Exit transformer on target process exit
  • Loading branch information
edgurgel authored Oct 1, 2019
2 parents 1b61003 + 0bbb1b3 commit a597e64
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 a597e64

Please sign in to comment.