Rescue from error updating feeds

This commit is contained in:
Shadowfacts 2020-06-06 13:45:22 -04:00
parent 55c6d6fd88
commit 3cd6495d3a
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 15 additions and 4 deletions

View File

@ -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