Skip to content

Commit

Permalink
fix: ADM handle connection timeout (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
talklittle authored and hpopp committed Oct 15, 2018
1 parent 72d92c5 commit 55ff7bd
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/pigeon/adm/worker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,15 @@ defmodule Pigeon.ADM.Worker do

_ ->
fn {reg_id, payload} ->
{:ok, %HTTPoison.Response{status_code: status, body: body}} =
HTTPoison.post(adm_uri(reg_id), payload, adm_headers(state))

notification = %{notification | registration_id: reg_id}
process_response(status, body, notification, on_response)
case HTTPoison.post(adm_uri(reg_id), payload, adm_headers(state)) do
{:ok, %HTTPoison.Response{status_code: status, body: body}} ->
notification = %{notification | registration_id: reg_id}
process_response(status, body, notification, on_response)

{:error, %HTTPoison.Error{reason: :connect_timeout}} ->
notification = %{notification | response: :timeout}
process_on_response(on_response, notification)
end
end
end

Expand Down

0 comments on commit 55ff7bd

Please sign in to comment.