Misc bug fixes

This commit is contained in:
Shadowfacts 2019-07-01 17:46:54 -04:00
parent 6ec519a11f
commit d3d5e28b4e
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 5 additions and 3 deletions

View File

@ -83,7 +83,7 @@ defmodule Frenzy.UpdateFeeds do
Logger.debug("Got 301 redirect from #{feed.feed_url} to #{new_url}, updating feed URL") Logger.debug("Got 301 redirect from #{feed.feed_url} to #{new_url}, updating feed URL")
changeset = Feed.changeset(feed, %{feed_url: new_url}) changeset = Feed.changeset(feed, %{feed_url: new_url})
{:ok, feed} = Repo.insert(changeset) {:ok, feed} = Repo.update(changeset)
update_feed(feed) update_feed(feed)
{:error, %HTTPoison.Error{reason: reason}} -> {:error, %HTTPoison.Error{reason: reason}} ->
@ -129,7 +129,7 @@ defmodule Frenzy.UpdateFeeds do
content content
{:err, reason} -> {:err, reason} ->
Logger.warn("Unable to fetch article for #{url}: #{reason}") Logger.warn("Unable to fetch article for #{url}: #{inspect(reason)}")
entry.description entry.description
end end
@ -200,7 +200,7 @@ defmodule Frenzy.UpdateFeeds do
end end
end end
defp get_article_content(url) do defp get_article_content(url) when is_binary(url) and url != "" do
Logger.debug("Getting article from #{url}") Logger.debug("Getting article from #{url}")
case HTTPoison.get(url) do case HTTPoison.get(url) do
@ -228,4 +228,6 @@ defmodule Frenzy.UpdateFeeds do
{:err, reason} {:err, reason}
end end
end end
defp get_article_content(_url), do: {:err, "URL must be a non-empty string"}
end end