Skip to content

Commit de3ac97

Browse files
committed
Update splaylimit during daemon run
Prior to this commit, updates to splay settings in the Puppet configuration file (puppet.conf) would not get picked up in a daemonized Puppet run. This commit updates the daemon class to call a new public method in the splay job class to update the splaylimit.
1 parent ca922ca commit de3ac97

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/puppet/daemon.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ def run_event_loop
165165
reparse_run = Puppet::Scheduler.create_job(Puppet[:filetimeout]) do
166166
Puppet.settings.reparse_config_files
167167
agent_run.run_interval = Puppet[:runinterval]
168+
agent_run.splay_limit = Puppet[:splaylimit] if Puppet[:splay]
168169
if Puppet[:filetimeout] == 0
169170
reparse_run.disable
170171
else

lib/puppet/scheduler/splay_job.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ def ready?(time)
2525
end
2626
end
2727

28+
# Recalculates the splay limit.
29+
#
30+
# @param splay_limit [Integer] the maximum time to delay before an agent's first run.
31+
# @return [Integer] a random integer less than or equal to the splay limit.
32+
def splay_limit=(splay_limit)
33+
@splay = calculate_splay(splay_limit)
34+
end
35+
2836
private
2937

3038
def calculate_splay(limit)

0 commit comments

Comments
 (0)