Sha256: 60fce48d6e5dca4721009d64171205c977292129d4289e284f4ca9efbd80d5ae
Contents?: true
Size: 1.81 KB
Versions: 12
Compression:
Stored size: 1.81 KB
Contents
module Delayed module Backend module Mongoid # # Extend the Mongoid delayed job to add additional methods # class Job # # Helper to describe the status of the job # def status_description return 'Failed' if failed? locked_by.present? ? locked_by : "Scheduled (#{attempts})" end # # Display name for the job # def display_name payload_object.job_data['job_class'] rescue StandardError name end # # Safely get the payload object # def job_payload payload_object.inspect rescue StandardError => error "Unable to retrieve payload: #{error.message}" end # # Resubmit the job for processing # def resubmit set locked_at: nil, locked_by: nil, failed_at: nil, last_error: nil, run_at: Time.now.utc end # # Return the failed object out of the YAML # def failed_object failed_yaml.object rescue StandardError => error "Unknown object: #{error.message}" end # # Return the failed method out of the YAML # def failed_method_name failed_yaml.method_name rescue StandardError => error "Unknown method_name: #{error.message}" end # # Return the failed arguments out of the YAML # def failed_args failed_yaml.args rescue StandardError => error "Unknown args: #{error.message}" end # # Return the failed YAML # def failed_yaml @failed_yaml = YAML.load(handler) rescue StandardError '' end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems