lib/rocket_job/plugins/processing_window.rb in rocketjob-5.1.1 vs lib/rocket_job/plugins/processing_window.rb in rocketjob-5.2.0.beta1

- old
+ new

@@ -1,6 +1,6 @@ -require 'active_support/concern' +require "active_support/concern" module RocketJob module Plugins # Ensure that a job will only run between certain hours of the day, regardless of when it was # created/enqueued. Useful for creating a job now that should only be processed later during a @@ -47,12 +47,12 @@ validates_presence_of :processing_schedule, :processing_duration validates_each :processing_schedule do |record, attr, value| begin RocketJob::Plugins::Rufus::CronLine.new(value) - rescue ArgumentError => exc - record.errors.add(attr, exc.message) + rescue ArgumentError => e + record.errors.add(attr, e.message) end end end # Returns [true|false] whether this job is currently inside its processing window @@ -66,11 +66,12 @@ private # Only process this job if it is still in its processing window def rocket_job_processing_window_check return if rocket_job_processing_window_active? + logger.warn("Processing window closed before job was processed. Job is re-scheduled to run at: #{rocket_job_processing_schedule.next_time}") - self.worker_name ||= 'inline' + self.worker_name ||= "inline" requeue!(worker_name) end def rocket_job_processing_window_set_run_at self.run_at = rocket_job_processing_schedule.next_time unless rocket_job_processing_window_active?