Throttle retrying when APNS connection closed

This commit is contained in:
Shadowfacts 2024-04-09 11:50:44 -04:00
parent 4781e6d789
commit b8b58b14a4
1 changed files with 6 additions and 3 deletions

View File

@ -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} ->