Module: DelayedJobActivityMonitoring

Defined in:
lib/roqua/core_ext/delayed_job/activity_monitoring.rb

Overview

Updates the modification time of the file $RAILS_ROOT/tmp/delayed_job_activity when relevant worker activity occurs. To be used for monitoring whether a DelayedJob worker is still picking up new work in a timely fashion.

A file based approach is used so it is easy to add a health check to a Docker container with the following command: ‘find /app/tmp -mmin -$MAXIMUM_AGE_OF_FILE_IN_MINUTES -type f -print | grep delayed_job_activity`

Instance Method Summary collapse

Instance Method Details

#work_off(num = 100) ⇒ Object



13
14
15
16
# File 'lib/roqua/core_ext/delayed_job/activity_monitoring.rb', line 13

def work_off(num = 100)
  FileUtils.touch(Rails.root.join('tmp', 'delayed_job_activity'))
  super(num)
end