Spawn off on hides, adjust retries

This commit is contained in:
byte[] 2022-07-01 12:24:51 -04:00
parent dd85badae4
commit 51b2c7410c
3 changed files with 11 additions and 4 deletions

View file

@ -95,6 +95,9 @@ config :ex_aws, :hackney_opts,
use_default_pool: false, use_default_pool: false,
pool: false pool: false
config :ex_aws, :retries,
max_attempts: 20
if config_env() != :test do if config_env() != :test do
# Database config # Database config
config :philomena, Philomena.Repo, config :philomena, Philomena.Repo,

View file

@ -535,14 +535,16 @@ defmodule Philomena.Images do
defp process_after_hide(result) do defp process_after_hide(result) do
case result do case result do
{:ok, %{image: image, tags: tags, reports: {_count, reports}} = result} -> {: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) Comments.reindex_comments(image)
Reports.reindex_reports(reports) Reports.reindex_reports(reports)
Tags.reindex_tags(tags) Tags.reindex_tags(tags)
reindex_image(image) reindex_image(image)
reindex_copied_tags(result) reindex_copied_tags(result)
purge_files(image, image.hidden_image_key)
{:ok, result} {:ok, result}
@ -586,7 +588,9 @@ defmodule Philomena.Images do
|> Repo.transaction() |> Repo.transaction()
|> case do |> case do
{:ok, %{image: image, tags: tags}} -> {:ok, %{image: image, tags: tags}} ->
Thumbnailer.unhide_thumbnails(image, key) spawn(fn ->
Thumbnailer.unhide_thumbnails(image, key)
end)
reindex_image(image) reindex_image(image)
purge_files(image, image.hidden_image_key) purge_files(image, image.hidden_image_key)

View file

@ -47,7 +47,7 @@ defmodule Philomena.Objects do
run_all(fn opts -> run_all(fn opts ->
file_path file_path
|> ExAws.S3.Upload.stream_file() |> 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]) |> ExAws.request!(opts[:config_overrides])
end) end)
end end