Skip to content

Commit

Permalink
Merge pull request #4285 from nulib/deploy/staging
Browse files Browse the repository at this point in the history
Deploy v9.6.1 to production
  • Loading branch information
charlesLoder authored Dec 6, 2024
2 parents 82d1f6c + fcb2709 commit 0bed78e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
5 changes: 5 additions & 0 deletions app/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ config :authoritex,

config :httpoison_retry, wait: 50

config :ex_aws, :hackney_opts,
pool: :default,
max_connections: 500,
checkout_timeout: 30_000

config :meadow, :extra_mime_types, %{
"aif" => "audio/x-aiff",
"aifc" => "audio/x-aiff",
Expand Down
18 changes: 13 additions & 5 deletions app/lib/meadow/utils/aws/multipart_copy.ex
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,18 @@ defmodule Meadow.Utils.AWS.MultipartCopy do
other ->
other
end

case ExAws.S3.head_object(dest_bucket, dest_object) |> AWS.request() do
{:ok, anything} -> {:ok, anything}
other ->
Logger.error("Multipart copy failed: #{inspect(other)}")
{:error, "Multipart copy failed: #{inspect(other)}"}
end

end

defp copy_s3_object(%__MODULE__{content_length: length} = op) when length > @threshold do
Logger.debug("File size #{length} > #{@threshold}; using MultipartUpload")
Logger.info("File size #{length} > #{@threshold}; using MultipartUpload")

op
|> initiate_upload()
Expand All @@ -63,7 +71,7 @@ defmodule Meadow.Utils.AWS.MultipartCopy do
end

defp copy_s3_object(%__MODULE__{content_length: length} = op) do
Logger.debug("File size #{length} <= #{@threshold}; using CopyObject")
Logger.info("File size #{length} <= #{@threshold}; using CopyObject")

ExAws.S3.put_object_copy(
op.dest_bucket,
Expand Down Expand Up @@ -116,19 +124,19 @@ defmodule Meadow.Utils.AWS.MultipartCopy do
defp upload_chunks({:error, payload}), do: {:error, payload}

defp complete_upload({:error, %__MODULE__{} = op}) do
Logger.debug("Error encountered. Aborting multipart upload.")
Logger.error("Error encountered. Aborting multipart upload.")

ExAws.S3.abort_multipart_upload(op.dest_bucket, op.dest_object, op.upload_id)
|> AWS.request()
end

defp complete_upload({:error, other}) do
Logger.debug("Error encountered. #{inspect(other)}")
Logger.error("Error encountered. #{inspect(other)}")
{:error, parse_error(other)}
end

defp complete_upload({parts, %__MODULE__{} = op}) do
Logger.debug("Completing multipart upload.")
Logger.info("Completing multipart upload.")

ExAws.S3.complete_multipart_upload(op.dest_bucket, op.dest_object, op.upload_id, parts)
|> Map.put(:parser, &parse_complete_result/1)
Expand Down
2 changes: 1 addition & 1 deletion app/mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Meadow.MixProject do
use Mix.Project

@app_version "9.6.0"
@app_version "9.6.1"

def project do
[
Expand Down

0 comments on commit 0bed78e

Please sign in to comment.