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.



7
8
9
10
# File 'lib/puppet/scheduler/splay_job.rb', line 7

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

Instance Attribute Details

#splayObject (readonly)

Returns the value of attribute splay.



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

def splay
  @splay
end

#splay_limitObject

Returns the value of attribute splay_limit.



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

def splay_limit
  @splay_limit
end

Instance Method Details

#interval_to_next_from(time) ⇒ Object



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

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

#ready?(time) ⇒ Boolean

Returns:

  • (Boolean)


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

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