Module: Sentry::Sidekiq::Cron::Job

Defined in:
lib/sentry/sidekiq/cron/job.rb

Instance Method Summary collapse

Instance Method Details

#saveObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/sentry/sidekiq/cron/job.rb', line 15

def save
  # validation failed, do nothing
  return false unless super

  # fail gracefully if can't find class
  klass_const =
    begin
      ::Sidekiq::Cron::Support.constantize(klass.to_s)
    rescue NameError
      return true
    end

  # only patch if not explicitly included in job by user
  unless klass_const.send(:ancestors).include?(Sentry::Cron::MonitorCheckIns)
    klass_const.send(:include, Sentry::Cron::MonitorCheckIns)
    klass_const.send(:sentry_monitor_check_ins,
                     slug: name.to_s,
                     monitor_config: Sentry::Cron::MonitorConfig.from_crontab(parsed_cron.original))
  end

  true
end