Class: SimpleScheduler::FutureJob
- Inherits:
-
ActiveJob::Base
- Object
- ActiveJob::Base
- SimpleScheduler::FutureJob
- Defined in:
- lib/simple_scheduler/future_job.rb
Overview
Active Job class that wraps the scheduled job and determines if the job should still be run based on the scheduled time and when the job expires.
Defined Under Namespace
Classes: Expired
Class Method Summary collapse
-
.delete_all ⇒ Object
Delete all future jobs created by Simple Scheduler from the ‘Sidekiq::ScheduledSet`.
Instance Method Summary collapse
-
#perform(task_params, scheduled_time) ⇒ Object
Perform the future job as defined by the task.
Class Method Details
.delete_all ⇒ Object
Delete all future jobs created by Simple Scheduler from the ‘Sidekiq::ScheduledSet`.
31 32 33 34 35 |
# File 'lib/simple_scheduler/future_job.rb', line 31 def self.delete_all Task.scheduled_set.each do |job| job.delete if job.display_class == "SimpleScheduler::FutureJob" end end |
Instance Method Details
#perform(task_params, scheduled_time) ⇒ Object
Perform the future job as defined by the task.
22 23 24 25 26 27 28 |
# File 'lib/simple_scheduler/future_job.rb', line 22 def perform(task_params, scheduled_time) @task = Task.new(task_params) @scheduled_time = Time.at(scheduled_time).in_time_zone(@task.time_zone) raise Expired if expired? queue_task end |