Misc bug fixes
This commit is contained in:
parent
6ec519a11f
commit
d3d5e28b4e
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue