From 7ba83d0a1da3df05475e0c3a7273246bde1d3d2b Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 20 Nov 2025 16:55:07 +0100 Subject: [PATCH] Increase HTTP read timeout for expensive S3 batch delete operation --- app/lib/attachment_batch.rb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/lib/attachment_batch.rb b/app/lib/attachment_batch.rb index 374abfac49..cf08fdcf52 100644 --- a/app/lib/attachment_batch.rb +++ b/app/lib/attachment_batch.rb @@ -112,10 +112,17 @@ class AttachmentBatch keys.each_slice(LIMIT) do |keys_slice| logger.debug { "Deleting #{keys_slice.size} objects" } - bucket.delete_objects(delete: { - objects: keys_slice.map { |key| { key: key } }, - quiet: true, - }) + bucket.delete_objects( + { + delete: { + objects: keys_slice.map { |key| { key: key } }, + quiet: true, + }, + }, + { + http_read_timeout: [Paperclip::Attachment.default_options[:s3_options][:http_read_timeout], 120].max, + } + ) rescue => e retries += 1