From 1ce934b75ae94b866512cccb92d6795ee9e677d4 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Sat, 5 Nov 2022 11:39:30 -0400 Subject: [PATCH] Catch more errors, adjust retries --- config/runtime.exs | 5 +++++ lib/philomena/objects.ex | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/config/runtime.exs b/config/runtime.exs index 2e211f30..883f1345 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -95,6 +95,11 @@ config :ex_aws, :hackney_opts, use_default_pool: false, pool: false +config :ex_aws, :retries, + max_attempts: 20, + base_backoff_in_ms: 10, + max_backoff_in_ms: 10_000 + if config_env() != :test do # Database config config :philomena, Philomena.Repo, diff --git a/lib/philomena/objects.ex b/lib/philomena/objects.ex index cfd492d8..8c18f039 100644 --- a/lib/philomena/objects.ex +++ b/lib/philomena/objects.ex @@ -75,8 +75,8 @@ defmodule Philomena.Objects do file_path = Briefly.create!() download_file(source_key, file_path) upload(dest_key, file_path) - rescue - _ -> Logger.warn("Failed to copy #{source_key} -> #{dest_key}") + catch + _kind, _value -> Logger.warn("Failed to copy #{source_key} -> #{dest_key}") end end @@ -107,8 +107,8 @@ defmodule Philomena.Objects do try do wrapped.(opts) :ok - rescue - _ -> :error + catch + _kind, _value -> :error end end