diff options
author | sersut <serdar@opscode.com> | 2013-02-21 11:49:31 -0800 |
---|---|---|
committer | sersut <serdar@opscode.com> | 2013-02-21 11:49:31 -0800 |
commit | b81ee58be871800b022e84bd2d331c57645b6b80 (patch) | |
tree | df9f844921544f9ef6c92a24811f16e6d38f1114 /lib/chef/application/windows_service.rb | |
parent | c20b0324b0b2e162ce95584bef685d112bf7201d (diff) | |
download | chef-b81ee58be871800b022e84bd2d331c57645b6b80.tar.gz |
Enable chef-client windows_service to stop in a timely manner when splay is configured with a high number.
Diffstat (limited to 'lib/chef/application/windows_service.rb')
-rw-r--r-- | lib/chef/application/windows_service.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/chef/application/windows_service.rb b/lib/chef/application/windows_service.rb index d3493d8a47..42a9ee9783 100644 --- a/lib/chef/application/windows_service.rb +++ b/lib/chef/application/windows_service.rb @@ -65,7 +65,9 @@ class Chef end def service_main(*startup_parameters) - timeout = 0 + # Chef::Config is initialized during service_init + # Set the initial timeout to splay sleep time + timeout = rand Chef::Config[:splay] while running? do # Grab the service_action_mutex to make a chef-client run @@ -83,10 +85,7 @@ class Chef timeout = Chef::Config[:interval] # Honor splay sleep config - - splay = rand Chef::Config[:splay] - Chef::Log.debug("Splay sleep #{splay} seconds") - sleep splay + timeout += rand Chef::Config[:splay] # run chef-client only if service is in RUNNING state next if state != RUNNING |