docbrown/app/workers/comments/send_email_notification_worker.rb
Asha Balasubramaniam e5960810cc Migrate Comments::SendEmailNotificationJob to Sidekiq (#5427)
* Add sidekiq version of the corresponding delayed job
* Switch the invocation of the delayed job from `after_create` to
`after_create_commit` to avoid the race condition where the worker can
be executed before the comment is persisted. Added covering spec
for this change.
2020-01-10 13:59:12 -06:00

12 lines
279 B
Ruby

module Comments
class SendEmailNotificationWorker
include Sidekiq::Worker
sidekiq_options queue: :mailers
def perform(comment_id)
comment = Comment.find_by(id: comment_id)
NotifyMailer.new_reply_email(comment).deliver_now if comment
end
end
end