From 60a006e89fbe9d02a0385ff914a86d2e1fe786d5 Mon Sep 17 00:00:00 2001 From: tripleee Date: Mon, 23 Oct 2023 17:02:00 +0300 Subject: [PATCH] chatexchage/client.py: catch HTTPError for refused actions With this additional exception handler, the queue is properly drained when something fails, instead of retrying forever (Closes: #164) --- chatexchange/client.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/chatexchange/client.py b/chatexchange/client.py index 6e9322a..3bd06af 100644 --- a/chatexchange/client.py +++ b/chatexchange/client.py @@ -226,7 +226,11 @@ def _worker(self): "Now serving customer %d, %r", self._requests_served, next_action) + try: self._do_action_despite_throttling(next_action) + except requests.HTTPError as exc: + self.logger.error( + "Attempt %d: denied: %s", self._requests_served, exc) self._request_queue.task_done()