Skip to content

Commit

Permalink
chatexchage/client.py: catch HTTPError for refused actions
Browse files Browse the repository at this point in the history
With this additional exception handler, the queue is properly drained when something fails, instead of retrying forever

(Closes: #164)
  • Loading branch information
tripleee authored and Manishearth committed Oct 23, 2023
1 parent 011862c commit 60a006e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions chatexchange/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 60a006e

Please sign in to comment.