Class: Puppet::Scheduler::SplayJob Private

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

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of SplayJob.



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

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

Instance Attribute Details

#splayObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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

def splay
  @splay
end

Instance Method Details

#interval_to_next_from(time) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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

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

#ready?(time) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


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

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