Sha256: afbfa0ac14827d72df5761ff75763696fc74a38d9e588e1a90b6e6b2e998d93d
Contents?: true
Size: 1.8 KB
Versions: 72
Compression:
Stored size: 1.8 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.presence || "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
72 entries across 72 versions & 1 rubygems