From 57fdf06f0fe2f53c5dccfbffee867b7b0139840f Mon Sep 17 00:00:00 2001 From: Alex Pyrgiotis Date: Wed, 23 Nov 2022 13:09:26 +0200 Subject: [PATCH] Bump global timeout to two minutes Bump the global timeout used for various steps from 1 minute to 2 minutes. The reason is that we've seen several reports of operations failing due to timeout reasons, that were otherwise legitimately running. Also, bump the timeout used for compression, which has been reported as problematic as well. Refs #146 Refs #149 --- container/dangerzone.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/container/dangerzone.py b/container/dangerzone.py index 712d36b..e6a926e 100644 --- a/container/dangerzone.py +++ b/container/dangerzone.py @@ -24,7 +24,10 @@ import magic from PIL import Image # timeout in seconds for any single subprocess -DEFAULT_TIMEOUT: float = 60 +DEFAULT_TIMEOUT: float = 120 + +# timeout in seconds for compressing a single page of the final document +COMPRESSION_TIMEOUT: float = 10 def run_command( @@ -339,7 +342,7 @@ class DangerzoneConverter: # Compress self.update_progress("Compressing PDF") - compress_timeout = num_pages * 3 + compress_timeout = num_pages * COMPRESSION_TIMEOUT run_command( ["ps2pdf", "/tmp/safe-output.pdf", "/tmp/safe-output-compressed.pdf"], timeout_message=f"Error compressing PDF, ps2pdf timed out after {compress_timeout} seconds",