wait for server before registering function
Change-Id: If2fd7c907c9e3bc1a2e779af9ae834d5a0d3bcc7
diff --git a/turbo_hipster/worker_manager.py b/turbo_hipster/worker_manager.py
index c22d594..746e4f7 100644
--- a/turbo_hipster/worker_manager.py
+++ b/turbo_hipster/worker_manager.py
@@ -47,6 +47,7 @@
self.config['zuul_server']['gearman_host'],
self.config['zuul_server']['gearman_port']
)
+ self.gearman_worker.waitForServer()
self.gearman_worker.registerFunction(
'stop:turbo-hipster-manager-%s' % hostname)
@@ -118,6 +119,7 @@
def register_functions(self):
self.log.debug("Register functions with gearman")
for function_name, plugin in self.functions.items():
+ self.gearman_worker.waitForServer()
self.gearman_worker.registerFunction(function_name)
self.log.debug(self.gearman_worker.functions)