Class: Cron::Job
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- Cron::Job
- Defined in:
- lib/app/jobs/cron/job.rb
Overview
Base class for WeeklyJobs.
Support running only on certain days as defined by day_of_week method
Direct Known Subclasses
RecordDelayedJobMetrics, RestartOrphanedDelayedJobs, SwitchboardSyncConfiguration, SwitchboardSyncModels, TrimCollection
Instance Attribute Summary
Attributes inherited from ApplicationJob
Class Method Summary collapse
-
.cron_tab_entry(entry) ⇒ Object
Method to set the cron_tab.
Instance Method Summary collapse
-
#notify_job_failure(error, event) ⇒ Object
Sends support a notification if something goes awry.
-
#send_support_email(error, event) ⇒ Object
Sends support an email if something goes awry.
Methods inherited from ApplicationJob
#duration, #parse_payload, #perform, valid_environment?, valid_environments
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
Class Method Details
.cron_tab_entry(entry) ⇒ Object
Method to set the cron_tab
14 15 16 |
# File 'lib/app/jobs/cron/job.rb', line 14 def self.cron_tab_entry(entry) self.cron_tab = entry end |
Instance Method Details
#notify_job_failure(error, event) ⇒ Object
Sends support a notification if something goes awry
34 35 36 37 38 39 40 |
# File 'lib/app/jobs/cron/job.rb', line 34 def notify_job_failure(error, event) = { job_name: self.class.to_s.titleize, event: event, error_message: error., stack_trace: error.backtrace } SlackNotification.say , to: SystemConfiguration.slack_support_channel, template: :job_failure end |
#send_support_email(error, event) ⇒ Object
Sends support an email if something goes awry
21 22 23 24 25 26 27 28 29 |
# File 'lib/app/jobs/cron/job.rb', line 21 def send_support_email(error, event) email = EmailNotification.new email.to = '[email protected]' params = { current_date: I18n.l(Time.zone.today, format: :medium), event: event, error: error } email.from_template('support_ticket_notification', params) email.send_notification end |