Module: SimpleScheduler

Defined in:
lib/simple_scheduler.rb,
lib/simple_scheduler/at.rb,
lib/simple_scheduler/task.rb,
lib/simple_scheduler/railtie.rb,
lib/simple_scheduler/version.rb,
lib/simple_scheduler/future_job.rb,
lib/simple_scheduler/scheduler_job.rb

Overview

Module for scheduling jobs at specific times using Sidekiq.

Defined Under Namespace

Classes: At, FutureJob, Railtie, SchedulerJob, Task

Constant Summary collapse

VERSION =
"1.0.0".freeze

Class Method Summary collapse

Class Method Details

.expired_task(&block) ⇒ Object

Used by a Rails initializer to handle expired tasks.

SimpleScheduler.expired_task do |exception|
  ExceptionNotifier.notify_exception(
    exception,
    data: {
      task:      exception.task.name,
      scheduled: exception.scheduled_time,
      actual:    exception.run_time
    }
  )
end


23
24
25
# File 'lib/simple_scheduler.rb', line 23

def self.expired_task(&block)
  expired_task_blocks << block
end

.expired_task_blocksArray

Blocks that should be called when a task doesn't run because it has expired.

Returns:

  • (Array)


29
30
31
# File 'lib/simple_scheduler.rb', line 29

def self.expired_task_blocks
  @expired_task_blocks ||= []
end