Disable S3 Upload and use PutObject instead

This commit is contained in:
byte[] 2023-03-28 18:14:02 -04:00
parent ffe07cce3d
commit 8b44b0ed0a

View file

@ -48,14 +48,8 @@ defmodule Philomena.Objects do
# #
@spec upload(String.t(), String.t()) :: any() @spec upload(String.t(), String.t()) :: any()
def upload(key, file_path) do def upload(key, file_path) do
{_, mime} = Mime.file(file_path) # Workaround for API rate limit issues on R2
put(key, file_path)
run_all(fn opts ->
file_path
|> ExAws.S3.Upload.stream_file()
|> ExAws.S3.upload(opts[:bucket], key, content_type: mime, max_concurrency: 2)
|> ExAws.request!(opts[:config_overrides])
end)
end end
# #