Class: Delayed::Jobs::Worker

Inherits:
Object
  • Object
show all
Includes:
ServerProcessAble, StandardModel
Defined in:
lib/app/models/delayed/jobs/worker.rb

Overview

Capture a specific worker process

Instance Method Summary collapse

Methods included from ServerProcessAble

#check_in, included, #start, #stop

Methods included from StandardModel

#audit_action, #auto_strip_attributes, #capture_user_info, #clear_cache, #created_by_display_name, #delete_and_log, #destroy_and_log, included, #last_modified_by_display_name, #log_change, #log_deletion, #remove_blank_secure_fields, #save_and_log, #save_and_log!, #secure_fields, #update, #update!, #update_and_log, #update_and_log!

Methods included from App47Logger

clean_params, #clean_params, delete_parameter_keys, #log_controller_error, log_debug, #log_debug, log_error, #log_error, log_exception, #log_message, log_message, #log_warn, log_warn, mask_parameter_keys, #update_flash_messages

Instance Method Details

#dead?Boolean

Is this worker dead?, meaning has it reported in a timely manner

Returns:

  • (Boolean)


27
28
29
30
31
# File 'lib/app/models/delayed/jobs/worker.rb', line 27

def dead?
  last_check_in_at.present? ? check_in_limit > last_check_in_at : false
rescue StandardError
  true
end

#record_job(job) ⇒ Object

Record a job relative to the worker



19
20
21
22
# File 'lib/app/models/delayed/jobs/worker.rb', line 19

def record_job(job)
  stop
  runs.create!(name: job.display_name, locked_at: job.locked_at, locked_by: job.locked_by)
end