From cbe3308c3d6985837b7a6212efab7242118bab85 Mon Sep 17 00:00:00 2001 From: Luke Imhoff Date: Sun, 16 Dec 2018 22:01:35 -0600 Subject: [PATCH] fetch_and_import_range_from_sequence log exceptions instead of raise Fixes #1234 Raising the exception will kill all Tasks, the sequence and the fetcher because of the linking from `Task.async_stream`. This leads to when 1 Task times out in a DB transaction, they all are affected, leading to slowdowns when the sequence has to be rebuilt when the fetcher restarts. --- apps/indexer/lib/indexer/block/catchup/fetcher.ex | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/indexer/lib/indexer/block/catchup/fetcher.ex b/apps/indexer/lib/indexer/block/catchup/fetcher.ex index 6dd039404a..6c3b2866cb 100644 --- a/apps/indexer/lib/indexer/block/catchup/fetcher.ex +++ b/apps/indexer/lib/indexer/block/catchup/fetcher.ex @@ -220,6 +220,13 @@ defmodule Indexer.Block.Catchup.Fetcher do error end + rescue + exception -> + Logger.error(fn -> [Exception.format(:error, exception, __STACKTRACE__), ?\n, ?\n, "Retrying."] end) + + push_back(sequence, range) + + {:error, exception} end defp cap_seq(seq, errors) do