Slide 30
Slide 30 text
SubscriptionWorker
(Retry Path)
defmodule Level.WebPush.SubscriptionWorker do
def handle_info({:retry_web_push, payload, attempts}, state) do
make_request(state, payload, attempts)
end
defp handle_push_response(_, state, payload, attempts) do
if attempts < max_attempts() - 1, do: schedule_retry(payload, attempts + 1)
{:noreply, state}
end
defp schedule_retry(payload, attempts) do
Process.send_after(self(), {:retry_web_push, payload, attempts}, retry_timeout())
end
end
Schedule a retry in a configured
interval if we have not exceeded
max attempts