From 1406a0c03348c91e82960662294df452a89be1bf Mon Sep 17 00:00:00 2001 From: Henty Date: Thu, 26 Oct 2023 10:36:56 +0100 Subject: [PATCH] I think this should catch correct errors now --- src/version.py | 2 +- src/worker/email.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/version.py b/src/version.py index f80822f..91f085e 100644 --- a/src/version.py +++ b/src/version.py @@ -1 +1 @@ -VERSION = '1.0.28' +VERSION = '1.0.29' diff --git a/src/worker/email.py b/src/worker/email.py index 5a925f3..432a6f7 100644 --- a/src/worker/email.py +++ b/src/worker/email.py @@ -4,12 +4,14 @@ import logging import re from arq import Retry +from asyncio import CancelledError from buildpg import MultipleValues, Values from chevron import ChevronError from concurrent.futures import TimeoutError from datetime import datetime, timezone from foxglove import glove -from httpx import ConnectError +from httpcore import ReadTimeout as HttpReadTimeout +from httpx import ConnectError, ReadTimeout from itertools import chain from pathlib import Path from pydf import generate_pdf @@ -122,11 +124,11 @@ async def _send_mandrill(self, email_info: EmailInfo, attachments: List[dict]): defer = email_retrying[job_try - 1] try: if job_try >= 2: - main_logger.info('%s: sending data to mandrill', self.group_id) + main_logger.info('%s: ', self.group_id) r = await self.ctx['mandrill'].post('messages/send.json', **data) if job_try >= 2: main_logger.info('%s: finished sending data to mandrill', self.group_id) - except (ConnectError, TimeoutError) as e: + except (ConnectError, TimeoutError, ReadTimeout, HttpReadTimeout, CancelledError) as e: main_logger.info('client connection error group_id=%s job_try=%s defer=%ss', self.group_id, job_try, defer) raise Retry(defer=defer) from e except ApiError as e: