Sha256: 24465f3194c038d5c46f8c9e4dd90a728cef3931a1dbf10a4a1ac6e5e75836f6

Contents?: true

Size: 585 Bytes

Versions: 7

Compression:

Stored size: 585 Bytes

Contents

module Marty
  module BackgroundJob
    module FetchMissingInScheduleCronJobs
      def self.call
        in_dashboard = Marty::BackgroundJob::Schedule.all

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

        djs = Delayed::Job.
          where.not(cron: nil).
          where.not(cron: '').
          where("handler ILIKE '%job_class:%'")

        djs.where.not('handler ILIKE ANY ( array[?] )', names_conditions).
          or(djs.where.not(schedule_id: in_dashboard.map(&:id)))
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
marty-14.3.0 app/services/marty/background_job/fetch_missing_in_schedule_cron_jobs.rb
marty-14.0.0 app/services/marty/background_job/fetch_missing_in_schedule_cron_jobs.rb
marty-13.0.2 app/services/marty/background_job/fetch_missing_in_schedule_cron_jobs.rb
marty-11.0.0 app/services/marty/background_job/fetch_missing_in_schedule_cron_jobs.rb
marty-10.0.3 app/services/marty/background_job/fetch_missing_in_schedule_cron_jobs.rb
marty-10.0.2 app/services/marty/background_job/fetch_missing_in_schedule_cron_jobs.rb
marty-10.0.0 app/services/marty/background_job/fetch_missing_in_schedule_cron_jobs.rb