lib/rocket_job/plugins/processing_window.rb in rocketjob-2.1.3 vs lib/rocket_job/plugins/processing_window.rb in rocketjob-3.0.0.alpha
- old
+ new
@@ -18,17 +18,14 @@
# # Only run the job between the hours of 8:30am and 8:30pm. If it is after 8:30pm schedule
# # it to run at 8:30am the next day.
# class BusinessHoursJob < RocketJob::Job
# include RocketJob::Plugins::ProcessingWindow
#
- # # Set the default processing_window
- # rocket_job do |job|
- # # The start of the processing window
- # job.processing_schedule = "30 8 * * * America/New_York"
- # # How long the processing window is:
- # job.processing_duration = 12.hours
- # end
+ # # The start of the processing window
+ # self.processing_schedule = "30 8 * * * America/New_York"
+ # # How long the processing window is:
+ # self..processing_duration = 12.hours
#
# def perform
# # Job will only run between 8:30am and 8:30pm Eastern
# end
# end
@@ -39,11 +36,11 @@
# of the next processing window.
module ProcessingWindow
extend ActiveSupport::Concern
included do
- key :processing_schedule, String
- key :processing_duration, Integer
+ field :processing_schedule, type: String, class_attribute: true
+ field :processing_duration, type: Integer, class_attribute: true
before_create :rocket_job_processing_window_set_run_at
before_retry :rocket_job_processing_window_set_run_at
after_start :rocket_job_processing_window_check