Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit transformer on target process exit #395

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/httpoison/base.ex
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