diff options
author | rinpatch <rinpatch@sdf.org> | 2020-09-08 17:21:12 +0000 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-09-08 17:21:12 +0000 |
commit | 425324aae3d4534bc045466a1cc15653ddfa27d2 (patch) | |
tree | 2d785eb4396e2dc79bb6b0bed5d766b393479dd5 /lib/pleroma/uploaders | |
parent | 73dd5bdb7dcdf804bdbabcf632671d4de5042ebc (diff) | |
parent | 073f5490ece616fd9602382c1be1347457cbbe79 (diff) | |
download | pleroma-2.1.1.tar.gz |
Merge branch 'release/2.1.1' into 'stable'v2.1.1
2.1.1 release
See merge request pleroma/secteam/pleroma!13
Diffstat (limited to 'lib/pleroma/uploaders')
-rw-r--r-- | lib/pleroma/uploaders/s3.ex | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/pleroma/uploaders/s3.ex b/lib/pleroma/uploaders/s3.ex index a13ff23b6..6dbef9085 100644 --- a/lib/pleroma/uploaders/s3.ex +++ b/lib/pleroma/uploaders/s3.ex @@ -46,12 +46,23 @@ defmodule Pleroma.Uploaders.S3 do op = if streaming do - upload.tempfile - |> ExAws.S3.Upload.stream_file() - |> ExAws.S3.upload(bucket, s3_name, [ - {:acl, :public_read}, - {:content_type, upload.content_type} - ]) + op = + upload.tempfile + |> ExAws.S3.Upload.stream_file() + |> ExAws.S3.upload(bucket, s3_name, [ + {:acl, :public_read}, + {:content_type, upload.content_type} + ]) + + if Application.get_env(:tesla, :adapter) == Tesla.Adapter.Gun do + # set s3 upload timeout to respect :upload pool timeout + # timeout should be slightly larger, so s3 can retry upload on fail + timeout = Pleroma.HTTP.AdapterHelper.Gun.pool_timeout(:upload) + 1_000 + opts = Keyword.put(op.opts, :timeout, timeout) + Map.put(op, :opts, opts) + else + op + end else {:ok, file_data} = File.read(upload.tempfile) |