Throttle retrying when APNS connection closed
This commit is contained in:
parent
4781e6d789
commit
b8b58b14a4
|
@ -11,15 +11,18 @@ defmodule TuskerPush.Apns do
|
||||||
handle_response(resp, registration, payload)
|
handle_response(resp, registration, payload)
|
||||||
else
|
else
|
||||||
{:error, %Finch.Error{reason: :connection_closed}} ->
|
{:error, %Finch.Error{reason: :connection_closed}} ->
|
||||||
Logger.warning("Apns Finch connection_closed, retrying")
|
Logger.warning("Apns Finch connection_closed, retrying in 1s")
|
||||||
|
Process.sleep(1000)
|
||||||
__MODULE__.send(registration, payload)
|
__MODULE__.send(registration, payload)
|
||||||
|
|
||||||
{:error, %Finch.Error{reason: :disconnected}} ->
|
{:error, %Finch.Error{reason: :disconnected}} ->
|
||||||
Logger.warning("Apns Finch disconnected, retrying")
|
Logger.warning("Apns Finch disconnected, retrying in 1s")
|
||||||
|
Process.sleep(1000)
|
||||||
__MODULE__.send(registration, payload)
|
__MODULE__.send(registration, payload)
|
||||||
|
|
||||||
{:error, %Mint.TransportError{reason: :closed}} ->
|
{:error, %Mint.TransportError{reason: :closed}} ->
|
||||||
Logger.warning("Apns Mint transport closed, retrying")
|
Logger.warning("Apns Mint transport closed, retrying in 1s")
|
||||||
|
Process.sleep(1000)
|
||||||
__MODULE__.send(registration, payload)
|
__MODULE__.send(registration, payload)
|
||||||
|
|
||||||
{:error, reason} ->
|
{:error, reason} ->
|
||||||
|
|
Loading…
Reference in New Issue