From 74fe7c586ba581f547cde687e7d8e52b7e2d0354 Mon Sep 17 00:00:00 2001 From: Trenton H <797416+stumpylog@users.noreply.github.com> Date: Mon, 19 Jun 2023 08:21:10 -0700 Subject: [PATCH] Updates the httpx timeout to be 30s for all operations --- src/paperless_mail/parsers.py | 9 +++------ src/paperless_tika/parsers.py | 8 +++++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/paperless_mail/parsers.py b/src/paperless_mail/parsers.py index f7daa758e..dec2b4754 100644 --- a/src/paperless_mail/parsers.py +++ b/src/paperless_mail/parsers.py @@ -218,7 +218,7 @@ class MailDocumentParser(DocumentParser): file_multi_part[2], ) - response = httpx.post(url_merge, files=pdf_collection) + response = httpx.post(url_merge, files=pdf_collection, timeout=30.0) response.raise_for_status() # ensure we notice bad responses archive_path.write_bytes(response.content) @@ -336,6 +336,7 @@ class MailDocumentParser(DocumentParser): files=files, headers=headers, data=data, + timeout=30.0, ) response.raise_for_status() # ensure we notice bad responses except Exception as err: @@ -414,11 +415,7 @@ class MailDocumentParser(DocumentParser): file_multi_part[2], ) - response = httpx.post( - url, - files=files, - data=data, - ) + response = httpx.post(url, files=files, data=data, timeout=30.0) response.raise_for_status() # ensure we notice bad responses except Exception as err: raise ParseError(f"Error while converting document to PDF: {err}") from err diff --git a/src/paperless_tika/parsers.py b/src/paperless_tika/parsers.py index 8b476bfd8..876696633 100644 --- a/src/paperless_tika/parsers.py +++ b/src/paperless_tika/parsers.py @@ -96,7 +96,13 @@ class TikaDocumentParser(DocumentParser): data["pdfFormat"] = "PDF/A-3b" try: - response = httpx.post(url, files=files, headers=headers, data=data) + response = httpx.post( + url, + files=files, + headers=headers, + data=data, + timeout=30.0, + ) response.raise_for_status() # ensure we notice bad responses except Exception as err: raise ParseError(