From 76f532f1cfc10a735b5e23f924de2cb214242a0f Mon Sep 17 00:00:00 2001 From: Per Halvorsen Date: Mon, 21 Oct 2024 13:25:00 +0200 Subject: [PATCH] catch HTTP error in classify w/ exp. backoff --- src/stages/classify.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/stages/classify.py b/src/stages/classify.py index 6d535b2..093155d 100644 --- a/src/stages/classify.py +++ b/src/stages/classify.py @@ -415,6 +415,11 @@ def process(self, element): logging.info(f"Retrying in {wait*wait} seconds.") wait += 1 time.sleep(wait*wait) + except requests.exceptions.HTTPError as e: + logging.error(f"HTTP error: {e}") + logging.error(f"Retrying in {wait*wait} seconds.") + wait += 1 + time.sleep(wait*wait) response = requests.post(self.inference_url, json=data) response.raise_for_status()