aboutsummaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-01-04 11:26:34 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-06 15:27:35 +0000
commit05b4fbc947cd2bf9493b74a80d1b58c8ddd480a2 (patch)
tree7102217bd5347068d9171ed61dfb35506b1d0f7b /bitbake
parentebc169c36039cc682b28f29688769b5903372a76 (diff)
downloadopenembedded-core-contrib-05b4fbc947cd2bf9493b74a80d1b58c8ddd480a2.tar.gz
bitbake: uievent: refactor retry loop
Replaced 'while' loop with 'for' loop. Made the code more compact and hopefully more understandable. (Bitbake rev: 4e1e497c8432536b3522295e5b1284844ccea056) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/ui/uievent.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/bitbake/lib/bb/ui/uievent.py b/bitbake/lib/bb/ui/uievent.py
index a900555e33..df22e253ca 100644
--- a/bitbake/lib/bb/ui/uievent.py
+++ b/bitbake/lib/bb/ui/uievent.py
@@ -45,27 +45,24 @@ class BBUIEventQueue:
server.socket.settimeout(1)
self.EventHandle = None
- count_tries = 0
# the event handler registration may fail here due to cooker being in invalid state
# this is a transient situation, and we should retry a couple of times before
# giving up
- while self.EventHandle == None and count_tries < 5:
+ for count_tries in range(5):
self.EventHandle, error = self.BBServer.registerEventHandler(self.host, self.port)
- if (self.EventHandle != None):
+ if self.EventHandle != None:
break
- errmsg = "Could not register UI event handler. Error: %s, " \
- "host %s, port %d" % (error, self.host, self.port)
+ errmsg = "Could not register UI event handler. Error: %s, host %s, "\
+ "port %d" % (error, self.host, self.port)
bb.warn("%s, retry" % errmsg)
- count_tries += 1
+
import time
time.sleep(1)
-
-
- if self.EventHandle == None:
+ else:
raise Exception(errmsg)
self.server = server