Only re-exec on config change or HUP

There are 2 things at play here. First the logic added in
4cfeb28d12 is no longer needed
because our initial sleep time is very low and increases
gradually up to the max.

2nd, I'm proposing that we avoid reexecing unless the config
file actually changes. Not re-execing will give us the option
to optimize os-collect-config for some long running collectors
(like zaqar websockets).  Also, Os-collect-config updates would
already be handled by packaging restarts and or other deployment
system changes anyways.

Change-Id: I04b2752d007089f72af42c88c4249c3e11c8346f
This commit is contained in:
Dan Prince 2016-07-19 11:51:52 -04:00
parent c2bdb4f672
commit 90cb2721e9
1 changed files with 3 additions and 15 deletions

View File

@ -273,25 +273,13 @@ def __main__(args=sys.argv, collector_kwargs_map=None):
exitval = e.returncode
logger.error('Command failed, will not cache new data. %s'
% e)
if not CONF.one_time:
new_config_hash = getfilehash(config_files)
if config_hash == new_config_hash:
logger.warn(
'Sleeping %.2f seconds before re-exec.' %
sleep_time
)
time.sleep(sleep_time)
else:
# The command failed but the config file has
# changed re-exec now as the config file change
# may have fixed things.
logger.warn('Config changed, re-execing now')
config_hash = new_config_hash
else:
for changed in changed_keys:
cache.commit(changed)
if not CONF.one_time:
reexec_self()
new_config_hash = getfilehash(config_files)
if config_hash != new_config_hash:
reexec_self()
else:
logger.debug("No changes detected.")
if CONF.one_time: