Skip to content

Commit 5e1eecf

Browse files
committed
retry login on server connection issues
1 parent cf0255d commit 5e1eecf

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

Framework/deploy_handler/long_poll_handler.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,15 @@ def run(self, host: str) -> None:
8686
server_online = False
8787
continue
8888

89-
if resp.status_code != requests.codes['ok']:
90-
if resp.status_code == 401:
91-
# Logged out - sleep for a sec before returning so we
92-
# don't retry too fast.
93-
time.sleep(1)
94-
return
95-
89+
if not resp.ok:
9690
server_online = False
97-
print("[deploy] error communicating with the deploy service, status code:", resp.status_code, " | reconnecting")
91+
print("[deploy] facing difficulty communicating with the server, status code:", resp.status_code, " | reconnecting")
9892
try: print(Fore.YELLOW + str(resp.content))
9993
except: pass
100-
continue
94+
95+
# Encountered a server error, retry.
96+
time.sleep(random.randint(1, 3))
97+
return
10198

10299
self.on_message(resp.content)
103100
reconnect = False

0 commit comments

Comments
 (0)