diff --git a/lib/frenzy/update_feeds.ex b/lib/frenzy/update_feeds.ex index 00b0eeb..d28c0b5 100644 --- a/lib/frenzy/update_feeds.ex +++ b/lib/frenzy/update_feeds.ex @@ -38,9 +38,7 @@ defmodule Frenzy.UpdateFeeds do end defp update_feeds() do - Logger.info("Updating all feeds") - - {_count, feeds} = + {count, feeds} = Feed |> where( [f], @@ -50,7 +48,20 @@ defmodule Frenzy.UpdateFeeds do |> select([f], f) |> Repo.update_all(set: [last_refreshed_at: DateTime.utc_now()]) - Enum.map(feeds, &update_feed/1) + Logger.info("Updating #{count} feeds") + + Enum.each(feeds, &update_feed/1) + + Enum.each(feeds, fn feed -> + try do + update_feed(feed) + rescue + error -> + Logger.warn( + "Encountered error updating feed #{feed.id} #{feed.feed_url}: #{inspect(error)}" + ) + end + end) prune_old_items() end