Speed up metadata server registration
If heat-engine and heat-metadata were started at approximately the same time, such that heat-engine was not ready to receive the registration call from heat-metadata on the first attempt, it would take a minute before the next retry. Instead, start with a very short timeout (2s) and increase it if the engine does not show up. Fixes #159 Change-Id: Ie2efcce667f1dde9ae227a4bb19a1d6a2b7cf135 Signed-off-by: Zane Bitter <zbitter@redhat.com>
This commit is contained in:
parent
e4eaca5d58
commit
8cbd065bf0
|
@ -45,15 +45,20 @@ LOG = logging.getLogger('heat.metadata')
|
|||
|
||||
def send_address_to_engine(host, port):
|
||||
con = context.get_admin_context()
|
||||
timeout = 2
|
||||
while True:
|
||||
try:
|
||||
resp = rpc.call(con, 'engine',
|
||||
{'method': 'metadata_register_address',
|
||||
'args': {'url': 'http://%s:%s' % (host, port)}})
|
||||
LOG.info('registered the hostname and port with the engine.')
|
||||
return
|
||||
'args': {'url': 'http://%s:%s' % (host, port)}},
|
||||
timeout=timeout)
|
||||
except rpc.common.Timeout:
|
||||
LOG.info('Could not connect to the engine, retrying...')
|
||||
if timeout < 30:
|
||||
timeout *= 2
|
||||
else:
|
||||
LOG.info('registered the hostname and port with the engine.')
|
||||
return
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in New Issue