Skip to content

Commit

Permalink
Don't retry email delivery on permanent failure error
Browse files Browse the repository at this point in the history
  • Loading branch information
ku1ik committed Jan 15, 2024
1 parent d580ea1 commit a24e86c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/asciinema/emails.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,22 @@ defmodule Asciinema.Emails do
"signup" ->
job.args["to"]
|> Email.signup_email(job.args["url"])
|> Mailer.deliver_now!()
|> deliver()

"login" ->
job.args["to"]
|> Email.login_email(job.args["url"])
|> Mailer.deliver_now!()
|> deliver()
end

:ok
end

defp deliver(email) do
with {:permanent_failure, _, _} <- Mailer.deliver_now!(email) do
{:cancel, :permanent_failure}
end
end
end

def send_email(type, to, url) do
Expand Down

0 comments on commit a24e86c

Please sign in to comment.