Module: Workarea::ScheduledJobs

Defined in:
lib/workarea/scheduled_jobs.rb

Class Method Summary collapse

Class Method Details

.cleanObject

Remove any scheduled jobs that still exist in Redis, but no longer have a worker class available for them. Fixes an issue wherein removing a previously scheduled job from initializers doesn’t actually stop the job from being enqueued.



7
8
9
10
11
12
13
# File 'lib/workarea/scheduled_jobs.rb', line 7

def self.clean
  return if Workarea.config.skip_service_connections

  Sidekiq::Cron::Job.all.each do |job|
    job.destroy unless const_defined?(job.klass)
  end
end