Skip to contentSkip to conversation

Server comm: try connecting 4 times before giving up

PATCH In review Lucas Dutra Nunes 1 participant 2 messages Mar 1, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Server comm: try connecting 4 times before giving up

Instead of trying one time with a timeout of 20 seconds try 4 times with a timeout of 5 seconds, to account for a slow server start.

---
 lib/bb/server/process.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
lib/bb/server/process.py +6 -4
index 1e2b824..e387b30 100644
@@ -53,10 +53,12 @@ class ServerCommunicator():
         while True:
             # don't let the user ctrl-c while we're waiting for a response
             try:
-                if self.connection.poll(20):
-                    return self.connection.recv()
-                else:
-                    bb.fatal("Timeout while attempting to communicate with bitbake server")
+                for idx in range(0,4): # 0, 1, 2, 3
+                    if self.connection.poll(5):
+                        return self.connection.recv()
+                    else:
+                        bb.warn("Timeout while attempting to communicate with bitbake server")
+                bb.fatal("Gave up; Too many tries: timeout while attempting to communicate with bitbake server")
             except KeyboardInterrupt:
                 pass
 
Signature · 1 line
2.1.4
#1 lore raw

Please ignore the [Documentation] tag, I forgot to remove it.

Signature · 1 line
Lucas Dutra Nunes