Fix crash on missing feed update date

This commit is contained in:
Shadowfacts 2019-06-30 21:25:11 -04:00
parent 68280cea8e
commit b686938bfa
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 8 additions and 1 deletions

View File

@ -80,11 +80,18 @@ defmodule Frenzy.UpdateFeeds do
end
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 =
Feed.changeset(feed, %{
title: rss.title,
site_url: rss.link.href,
last_updated: parse_date(rss.updated_at)
last_updated: last_updated
})
Repo.update(changeset)