From 8cbd065bf0124290a828320f9087ce9183ee73fc Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Wed, 11 Jul 2012 15:12:23 -0400 Subject: [PATCH] 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 --- bin/heat-metadata | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/heat-metadata b/bin/heat-metadata index beb5b1e80f..fb7802beba 100755 --- a/bin/heat-metadata +++ b/bin/heat-metadata @@ -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__':