Class: Puppet::Scheduler::SplayJob

Inherits:
Job show all
Defined in:
lib/puppet/scheduler/splay_job.rb

Instance Attribute Summary collapse

Attributes inherited from Job

#last_run, #run_interval, #start_time

Instance Method Summary collapse

Methods inherited from Job

#disable, #enable, #enabled?, #run

Constructor Details

#initialize(run_interval, splay_limit, &block) ⇒ SplayJob

Returns a new instance of SplayJob.



5
6
7
8
# File 'lib/puppet/scheduler/splay_job.rb', line 5

def initialize(run_interval, splay_limit, &block)
  @splay = calculate_splay(splay_limit)
  super(run_interval, &block)
end

Instance Attribute Details

#splayObject (readonly)

Returns the value of attribute splay.



3
4
5
# File 'lib/puppet/scheduler/splay_job.rb', line 3

def splay
  @splay
end

Instance Method Details

#interval_to_next_from(time) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/puppet/scheduler/splay_job.rb', line 10

def interval_to_next_from(time)
  if last_run
    super
  else
    (start_time + splay) - time
  end
end

#ready?(time) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
24
# File 'lib/puppet/scheduler/splay_job.rb', line 18

def ready?(time)
  if last_run
    super
  else
    start_time + splay <= time
  end
end