Sha256: 1c3c257a7811880daa64d14d41e94184c773f7b4939fd5269038c3856c36b15d

Contents?: true

Size: 1.37 KB

Versions: 73

Compression:

Stored size: 1.37 KB

Contents

require 'aws-sdk-s3'
require 'mail'
require 'sidekiq'
require 'exception_notification'

##
## 2023-02-26 _vp_ Let's go
## 2023-03-07 _vp_ Continue
## 2023-12-28 _vp_ Continue
##
class WcoEmail::MessageIntakeJob
  include Sidekiq::Job

  sidekiq_options queue: 'wco_email_rb'

=begin

  ## Mongo::Error::MaxBSONSize: The document exceeds maximum allowed BSON object size after serialization (on 10.138.2.145)
  object_key = 'k9n9qo03fii2in3ocj977nac0vj5djn07e110bg1'

  object_key = 'hlbg24s1ov5k7irgmqsrjp0kl95vpik8t1esvs81'
  MsgStub.where({ object_key: object_key }).delete

  stub = MsgStub.create!({ object_key: object_key })
  id = stub.id

  Ishapi::EmailMessageIntakeJob.perform_now( stub.id.to_s )

=end
  def perform id
    stub = WcoEmail::MessageStub.find id
    puts "+++ +++ Performing WcoEmail::MessageIntakeJob for object_key `#{stub.object_key}`."

    if [ WcoEmail::MessageStub::STATUS_PROCESSED, WcoEmail::MessageStub::STATUS_FAILED ].include?( stub.status )
      raise "This stub has already been processed, or errored out: #{stub.id.to_s}."
      return
    end

    begin
      stub.do_process
    rescue => err
      stub.update({ status: WcoEmail::MessageStub::STATUS_FAILED })
      puts! err, "WcoEmail::MessageIntakeJob error"
      ::ExceptionNotifier.notify_exception(
        err,
        data: { stub: stub }
      )
    end

  end
end
EIJ = WcoEmail::MessageIntakeJob

Version data entries

73 entries across 73 versions & 1 rubygems

Version Path
wco_email-0.1.1.89 app/jobs/wco_email/message_intake_job.rb
wco_email-0.1.1.88 app/jobs/wco_email/message_intake_job.rb
wco_email-0.1.1.86 app/jobs/wco_email/message_intake_job.rb
wco_email-0.1.1.85 app/jobs/wco_email/message_intake_job.rb
wco_email-0.1.1.84 app/jobs/wco_email/message_intake_job.rb
wco_email-0.1.1.83 app/jobs/wco_email/message_intake_job.rb
wco_email-0.1.1.82 app/jobs/wco_email/message_intake_job.rb
wco_email-0.1.1.81 app/jobs/wco_email/message_intake_job.rb
wco_email-0.1.1.80 app/jobs/wco_email/message_intake_job.rb
wco_email-0.1.1.79 app/jobs/wco_email/message_intake_job.rb
wco_email-0.1.1.78 app/jobs/wco_email/message_intake_job.rb
wco_email-0.1.1.77 app/jobs/wco_email/message_intake_job.rb
wco_email-0.1.1.76 app/jobs/wco_email/message_intake_job.rb
wco_email-0.1.1.75 app/jobs/wco_email/message_intake_job.rb
wco_email-0.1.1.72 app/jobs/wco_email/message_intake_job.rb
wco_email-0.1.1.71 app/jobs/wco_email/message_intake_job.rb
wco_email-0.1.1.70 app/jobs/wco_email/message_intake_job.rb
wco_email-0.1.1.69 app/jobs/wco_email/message_intake_job.rb
wco_email-0.1.1.68 app/jobs/wco_email/message_intake_job.rb
wco_email-0.1.1.67 app/jobs/wco_email/message_intake_job.rb