Fix crash on missing feed update date
This commit is contained in:
parent
68280cea8e
commit
b686938bfa
|
@ -80,11 +80,18 @@ defmodule Frenzy.UpdateFeeds do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp update_feed_from_rss(feed, rss) do
|
defp update_feed_from_rss(feed, rss) do
|
||||||
|
last_updated =
|
||||||
|
if rss.updated_at do
|
||||||
|
parse_date(rss.updated_at)
|
||||||
|
else
|
||||||
|
DateTime.utc_now()
|
||||||
|
end
|
||||||
|
|
||||||
changeset =
|
changeset =
|
||||||
Feed.changeset(feed, %{
|
Feed.changeset(feed, %{
|
||||||
title: rss.title,
|
title: rss.title,
|
||||||
site_url: rss.link.href,
|
site_url: rss.link.href,
|
||||||
last_updated: parse_date(rss.updated_at)
|
last_updated: last_updated
|
||||||
})
|
})
|
||||||
|
|
||||||
Repo.update(changeset)
|
Repo.update(changeset)
|
||||||
|
|
Loading…
Reference in New Issue