Rescue from error updating feeds
This commit is contained in:
parent
55c6d6fd88
commit
3cd6495d3a
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user