Rescue from error updating feeds
This commit is contained in:
parent
55c6d6fd88
commit
3cd6495d3a
@ -38,9 +38,7 @@ defmodule Frenzy.UpdateFeeds do
|
|||||||
end
|
end
|
||||||
|
|
||||||
defp update_feeds() do
|
defp update_feeds() do
|
||||||
Logger.info("Updating all feeds")
|
{count, feeds} =
|
||||||
|
|
||||||
{_count, feeds} =
|
|
||||||
Feed
|
Feed
|
||||||
|> where(
|
|> where(
|
||||||
[f],
|
[f],
|
||||||
@ -50,7 +48,20 @@ defmodule Frenzy.UpdateFeeds do
|
|||||||
|> select([f], f)
|
|> select([f], f)
|
||||||
|> Repo.update_all(set: [last_refreshed_at: DateTime.utc_now()])
|
|> 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()
|
prune_old_items()
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user