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:
parent
c2bdb4f672
commit
90cb2721e9
@ -273,25 +273,13 @@ def __main__(args=sys.argv, collector_kwargs_map=None):
|
|||||||
exitval = e.returncode
|
exitval = e.returncode
|
||||||
logger.error('Command failed, will not cache new data. %s'
|
logger.error('Command failed, will not cache new data. %s'
|
||||||
% e)
|
% 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:
|
else:
|
||||||
for changed in changed_keys:
|
for changed in changed_keys:
|
||||||
cache.commit(changed)
|
cache.commit(changed)
|
||||||
if not CONF.one_time:
|
if not CONF.one_time:
|
||||||
reexec_self()
|
new_config_hash = getfilehash(config_files)
|
||||||
|
if config_hash != new_config_hash:
|
||||||
|
reexec_self()
|
||||||
else:
|
else:
|
||||||
logger.debug("No changes detected.")
|
logger.debug("No changes detected.")
|
||||||
if CONF.one_time:
|
if CONF.one_time:
|
||||||
|
Loading…
Reference in New Issue
Block a user