module LoggingWorker::Worker

Public Instance Methods

job_run() click to toggle source
# File lib/logging_worker/worker.rb, line 13
def job_run
  @job_run ||= job_run_class.new
end
job_run_class() click to toggle source
# File lib/logging_worker/worker.rb, line 5
def job_run_class
  if sidekiq_options_hash && sidekiq_options_hash.has_key?("job_run_class")
    sidekiq_options_hash["job_run_class"]
  else
    LoggingWorker::JobRun
  end
end
perform(*args) click to toggle source
Calls superclass method
# File lib/logging_worker/worker.rb, line 17
def perform(*args)
  job_run.worker_class = self.class.name
  job_run.arguments = args
  job_run.save!

  super

  job_run.successful!
rescue => e
  job_run.error_class = e.class.name
  job_run.error_message = e.message
  job_run.error_backtrace = e.backtrace
  job_run.save!
  raise e
ensure
  job_run.completed!
end