Class: ExampleSchedulerJob

Inherits:
SchedulerJob show all
Defined in:
app/jobs/example_scheduler_job.rb

Instance Method Summary collapse

Methods inherited from SchedulerJob

#handle_error

Instance Method Details

#perform(job_class, job_id, *args, &block) ⇒ nil

Performs job with ActiveJob framework.

Parameters:

  • job_id (String)

    the id of the corresponding Job.

  • work_time (Integer)

    an example amount of time to simulate work.

Returns:

  • (nil)


10
11
12
13
14
15
16
# File 'app/jobs/example_scheduler_job.rb', line 10

def perform(job_class, job_id, *args, &block)
  super do |job, work_time|
    job.log :info, "Preparing to do some work for #{work_time} seconds."
    sleep work_time
    job.log :info, "Work done!"
  end
end