Created
August 9, 2018 12:30
-
-
Save manoelneto/9d47156286bf23d9c701e10824fd5948 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Controller | |
SendEmailToUser.perform_async user.id | |
# ... | |
class SendEmailToUser | |
include Sidekiq::Worker | |
sidekiq_options :queue => :default, :retry => true, :backtrace => true | |
def perform user_id | |
begin | |
user = User.find user_id | |
rescue ActiveRecord::DocumentNotFound => e | |
logger.warn "User não existe, ignorando" | |
return | |
end | |
Mailer.send_mail_user(user).deliver | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment