Don't log errors when uncles aren't found

Fixes #1221

It happens too often to be worth treating as an error as we should only
log things that are exceptional and need human attention as errors.
pull/1222/head
Luke Imhoff 6 years ago
parent 14c17cb2ee
commit 5a0f02019b
  1. 31
      apps/indexer/lib/indexer/block/uncle/fetcher.ex

@ -189,20 +189,31 @@ defmodule Indexer.Block.Uncle.Fetcher do
defp retry(errors) when is_list(errors) do
retried_entries = errors_to_entries(errors)
Logger.error(
fn ->
[
"failed to fetch: ",
errors_to_iodata(errors)
]
end,
error_count: Enum.count(retried_entries)
)
loggable_errors = loggable_errors(errors)
loggable_error_count = Enum.count(loggable_errors)
unless loggable_error_count == 0 do
Logger.error(
fn ->
[
"failed to fetch: ",
errors_to_iodata(loggable_errors)
]
end,
error_count: loggable_error_count
)
end
{:retry, retried_entries}
end
defp loggable_errors(errors) when is_list(errors) do
Enum.filter(errors, fn
%{code: 404, message: "Not Found"} -> false
_ -> true
end)
end
defp errors_to_entries(errors) when is_list(errors) do
Enum.map(errors, &error_to_entry/1)
end

Loading…
Cancel
Save