Commit bf536498 authored by Bruno Duyé's avatar Bruno Duyé

Handle server Tomcat internal server errors

parent 804ff3d2
Pipeline #10191 passed with stage
in 2 minutes and 30 seconds
......@@ -209,9 +209,12 @@ def get_from_api(url, raise_on_errors=True):
while True:
response = requests_session.get(url)
content_str = response.content
if content_str.startswith(b"<BEAAPI>") and b"Exceeded request quota per minute" in content_str:
if (content_str.startswith(b"<BEAAPI>") and b"Exceeded request quota per minute" in content_str) \
or (content_str.startswith(b"The service is unavailable")): # Tomcat error (https://git.nomics.world/dbnomics-fetchers/management/issues/251)
if content_str.startswith(b"The service is unavailable"):
log.debug("Tomcat error")
waiting_time = sleeps_times[sleep_time_index]
log.info("Exceeded request quota per minute. Waiting {} seconds ...".format(waiting_time))
log.info("Exceeded request quota per minute or server internal error. Waiting {} seconds ...".format(waiting_time))
time.sleep(sleeps_times[sleep_time_index])
if sleep_time_index < len(sleeps_times) - 1:
sleep_time_index += 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment