Skip to content

Commit 6ca39ec

Browse files
authored
Retry 5xx in testmo interaction (Server response (503): Account is in maintenance mode) (#8519)
1 parent c5304ff commit 6ca39ec

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

ydb/ci/testmo-proxy/testmo-proxy.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,21 @@ def _proxy_request(self, method):
4545
start_time = time.monotonic()
4646

4747
response = None
48+
sleep_for_5xx = 30 # sec
49+
sleep_for_timeout = 0.25 # sec
4850

4951
while time.monotonic() - start_time < self._max_request_time:
5052
try:
5153
response = requests.request(method, url, data=body, headers=headers, timeout=self._timeout)
52-
break
54+
if 500 <= response.status_code < 600:
55+
self.log_message(f"! received status={response.status_code}, content={response.content}")
56+
self.log_message(f"sleep for {sleep_for_5xx} sec")
57+
time.sleep(sleep_for_5xx)
58+
else:
59+
break
5360
except requests.exceptions.RequestException as e:
5461
self.log_message("! catch %s, retry", e)
55-
time.sleep(0.25)
62+
time.sleep(sleep_for_timeout)
5663
continue
5764

5865
if response is None:

0 commit comments

Comments
 (0)