Module: Marty::BackgroundJob::FetchMissingInScheduleCronJobs

Defined in:
app/services/marty/background_job/fetch_missing_in_schedule_cron_jobs.rb

Class Method Summary collapse

Class Method Details

.callObject



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/services/marty/background_job/fetch_missing_in_schedule_cron_jobs.rb', line 4

def self.call
  in_dashboard = Marty::BackgroundJob::Schedule.pluck(:job_class)

  names_conditions = in_dashboard.map do |job_class_name|
    "%job_class: #{job_class_name}\n%"
  end

  Delayed::Job.
    where.not(cron: nil).
    where.not(cron: '').
    where("handler ILIKE '%job_class:%'").
    where.not('handler ILIKE ANY ( array[?] )', names_conditions)
end