Sha256: 35e3d0b4c7ffea3ad99dcff7bdea55060e320c5898989d330282dc1c41c84fc9

Contents?: true

Size: 612 Bytes

Versions: 3

Compression:

Stored size: 612 Bytes

Contents

module GeorgiaMailer
  class SpamWorker
    include Sidekiq::Worker

    def perform(message_id)
      begin
        @message = GeorgiaMailer::Message.find(message_id)
        is_spam = @message.spam?
        @message.update_attributes(spam: is_spam, verified_at: Time.zone.now)
        unless @message.spam or !GeorgiaMailer.turn_on_email_notifications
          GeorgiaMailer::Notifier.new_message_notification(@message).deliver
        end
      rescue ActiveRecord::RecordNotFound
        Rails.logger.info "Message with ID #{message_id} was destroy before it could be processed"
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
georgia_mailer-0.1.2 app/workers/georgia_mailer/spam_worker.rb
georgia_mailer-0.1.1 app/workers/georgia_mailer/spam_worker.rb
georgia_mailer-0.1.0 app/workers/georgia_mailer/spam_worker.rb