diff --git a/config/runtime.exs b/config/runtime.exs index 2e211f30..d5dfc5cb 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -95,6 +95,9 @@ config :ex_aws, :hackney_opts, use_default_pool: false, pool: false +config :ex_aws, :retries, + max_attempts: 20 + if config_env() != :test do # Database config config :philomena, Philomena.Repo, diff --git a/lib/philomena/images.ex b/lib/philomena/images.ex index 7ecaf8ff..2ba12f82 100644 --- a/lib/philomena/images.ex +++ b/lib/philomena/images.ex @@ -535,14 +535,16 @@ defmodule Philomena.Images do defp process_after_hide(result) do case result do {:ok, %{image: image, tags: tags, reports: {_count, reports}} = result} -> - Thumbnailer.hide_thumbnails(image, image.hidden_image_key) + spawn(fn -> + Thumbnailer.hide_thumbnails(image, image.hidden_image_key) + purge_files(image, image.hidden_image_key) + end) Comments.reindex_comments(image) Reports.reindex_reports(reports) Tags.reindex_tags(tags) reindex_image(image) reindex_copied_tags(result) - purge_files(image, image.hidden_image_key) {:ok, result} @@ -586,7 +588,9 @@ defmodule Philomena.Images do |> Repo.transaction() |> case do {:ok, %{image: image, tags: tags}} -> - Thumbnailer.unhide_thumbnails(image, key) + spawn(fn -> + Thumbnailer.unhide_thumbnails(image, key) + end) reindex_image(image) purge_files(image, image.hidden_image_key) diff --git a/lib/philomena/objects.ex b/lib/philomena/objects.ex index 212bdf92..222c2546 100644 --- a/lib/philomena/objects.ex +++ b/lib/philomena/objects.ex @@ -47,7 +47,7 @@ defmodule Philomena.Objects do run_all(fn opts -> file_path |> ExAws.S3.Upload.stream_file() - |> ExAws.S3.upload(opts[:bucket], key, content_type: mime) + |> ExAws.S3.upload(opts[:bucket], key, content_type: mime, max_concurrency: 2) |> ExAws.request!(opts[:config_overrides]) end) end