Module: Scheddy

Defined in:
lib/scheddy.rb,
lib/scheddy/cli.rb,
lib/scheddy/task.rb,
lib/scheddy/config.rb,
lib/scheddy/engine.rb,
lib/scheddy/logger.rb,
lib/scheddy/context.rb,
lib/scheddy/version.rb,
lib/scheddy/scheduler.rb,
lib/scheddy/error_handler.rb,
app/models/scheddy/task_history.rb,
app/models/scheddy/task_scheduler.rb,
app/models/scheddy/application_record.rb

Defined Under Namespace

Classes: ApplicationRecord, CLI, Config, Context, Engine, Scheduler, Task, TaskDefinition, TaskHistory, TaskScheduler

Constant Summary collapse

VERSION =
'0.3.0'
LEASE_RENEWAL_INTERVAL =
1.minute
LEASE_DURATION =
4.minutes

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loggerObject



6
7
8
# File 'lib/scheddy/logger.rb', line 6

def logger
  @logger ||= Rails.logger
end

Class Method Details

.config(&block) ⇒ Object



5
6
7
# File 'lib/scheddy/config.rb', line 5

def self.config(&block)
  Config.new(tasks, &block)
end

.handle_error(e, task = nil) ⇒ Object



10
11
12
13
14
# File 'lib/scheddy/error_handler.rb', line 10

def self.handle_error(e, task=nil)
  if h = Scheddy.error_handler
    h.call(*[e, task].take(h.arity.abs))
  end
end

.runObject

must be > 2x the renewal interval



6
7
8
# File 'lib/scheddy/scheduler.rb', line 6

def self.run
  Scheduler.new(tasks).run
end