Compare commits
No commits in common. "5ece9cd21cd8dfad807374deffd8e4c540c11b73" and "1c2ef3bc51dd22719cfc47b54d7f4cd01b72c6a4" have entirely different histories.
5ece9cd21c
...
1c2ef3bc51
|
@ -23,10 +23,6 @@ defmodule Frenzy.Network do
|
||||||
|
|
||||||
@spec http_get(String.t()) :: Tesla.Env.result()
|
@spec http_get(String.t()) :: Tesla.Env.result()
|
||||||
def http_get(url) do
|
def http_get(url) do
|
||||||
if Frenzy.sentry_enabled?() do
|
|
||||||
Sentry.Context.add_breadcrumb(%{category: "http_get", message: url})
|
|
||||||
end
|
|
||||||
|
|
||||||
HTTP.get(url)
|
HTTP.get(url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -81,10 +77,6 @@ defmodule Frenzy.Network do
|
||||||
@spec gemini_request(String.t() | URI.t()) :: {:ok, Gemini.Response.t()} | {:error, term()}
|
@spec gemini_request(String.t() | URI.t()) :: {:ok, Gemini.Response.t()} | {:error, term()}
|
||||||
|
|
||||||
def gemini_request(uri) do
|
def gemini_request(uri) do
|
||||||
if Frenzy.sentry_enabled?() do
|
|
||||||
Sentry.Context.add_breadcrumb(%{category: "gemini_request", message: uri})
|
|
||||||
end
|
|
||||||
|
|
||||||
case Gemini.request(uri) do
|
case Gemini.request(uri) do
|
||||||
{:ok, %Gemini.Response{status: code} = response} when code in @gemini_success_codes ->
|
{:ok, %Gemini.Response{status: code} = response} when code in @gemini_success_codes ->
|
||||||
{:ok, response}
|
{:ok, response}
|
||||||
|
|
|
@ -152,10 +152,6 @@ defmodule Frenzy.Pipeline.ScrapeStage do
|
||||||
@content_type_allowlist ["image/jpeg", "image/png", "image/heic", "image/heif", "image/tiff"]
|
@content_type_allowlist ["image/jpeg", "image/png", "image/heic", "image/heif", "image/tiff"]
|
||||||
|
|
||||||
# convert images to data URIs so that they're stored by clients as part of the body
|
# convert images to data URIs so that they're stored by clients as part of the body
|
||||||
defp image_to_data_uri("data:" <> _ = src, _site_uri, _convert) do
|
|
||||||
src
|
|
||||||
end
|
|
||||||
|
|
||||||
defp image_to_data_uri(src, site_uri, true) do
|
defp image_to_data_uri(src, site_uri, true) do
|
||||||
absolute_url = URI.merge(site_uri, src) |> to_string()
|
absolute_url = URI.merge(site_uri, src) |> to_string()
|
||||||
|
|
||||||
|
|
|
@ -47,13 +47,6 @@ defmodule Frenzy.Task.CreateItem do
|
||||||
feed.pipeline.stages
|
feed.pipeline.stages
|
||||||
|> Enum.reduce({:ok, item_params}, fn
|
|> Enum.reduce({:ok, item_params}, fn
|
||||||
stage, {:ok, item_params} ->
|
stage, {:ok, item_params} ->
|
||||||
if Frenzy.sentry_enabled?() do
|
|
||||||
Sentry.Context.add_breadcrumb(%{
|
|
||||||
category: "pipeline",
|
|
||||||
message: stage["module_name"]
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
apply(String.to_existing_atom("Elixir." <> stage["module_name"]), :apply, [
|
apply(String.to_existing_atom("Elixir." <> stage["module_name"]), :apply, [
|
||||||
stage["options"],
|
stage["options"],
|
||||||
item_params
|
item_params
|
||||||
|
@ -76,12 +69,8 @@ defmodule Frenzy.Task.CreateItem do
|
||||||
|
|
||||||
if Frenzy.sentry_enabled?() do
|
if Frenzy.sentry_enabled?() do
|
||||||
Sentry.capture_message(
|
Sentry.capture_message(
|
||||||
"Error evaluating pipeline: #{inspect(error)}",
|
"Error evaluating pipeline '#{feed.pipeline.name}': #{inspect(error)}",
|
||||||
extra: %{
|
extra: %{feed_id: feed.id, pipeline_id: feed.pipeline.id}
|
||||||
feed_id: feed.id,
|
|
||||||
pipeline_id: feed.pipeline.id,
|
|
||||||
pipeline_name: feed.pipeline.name
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -117,12 +106,8 @@ defmodule Frenzy.Task.CreateItem do
|
||||||
Logger.error(changeset.errors)
|
Logger.error(changeset.errors)
|
||||||
|
|
||||||
if Frenzy.sentry_enabled?() do
|
if Frenzy.sentry_enabled?() do
|
||||||
Sentry.capture_message("Error inserting item: #{inspect(changeset.errors)}",
|
Sentry.capture_message("Error inserting item '#{item_params.guid}'",
|
||||||
extra: %{
|
extra: %{feed_id: feed.id, errors: changeset.errors}
|
||||||
item_guid: item_params.guid,
|
|
||||||
feed_id: feed.id,
|
|
||||||
errors: changeset.errors
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -151,8 +151,8 @@ defmodule Frenzy.UpdateFeeds do
|
||||||
Logger.error("Couldn't load feed #{feed.feed_url}: #{inspect(reason)}")
|
Logger.error("Couldn't load feed #{feed.feed_url}: #{inspect(reason)}")
|
||||||
|
|
||||||
if Frenzy.sentry_enabled?() do
|
if Frenzy.sentry_enabled?() do
|
||||||
Sentry.capture_message("Error loading HTTP feed: #{inspect(reason)}",
|
Sentry.capture_message("Error loading HTTP feed '#{feed.feed_url}': #{inspect(reason)}",
|
||||||
extra: %{feed_id: feed.id, feed_url: feed.feed_url}
|
extra: %{feed_id: feed.id}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -168,8 +168,8 @@ defmodule Frenzy.UpdateFeeds do
|
||||||
|
|
||||||
if Frenzy.sentry_enabled?() do
|
if Frenzy.sentry_enabled?() do
|
||||||
Sentry.capture_message(
|
Sentry.capture_message(
|
||||||
"Error loading Gemini feed: #{inspect(reason)}",
|
"Error loading Gemini feed '#{feed.feed_url}': #{inspect(reason)}",
|
||||||
extra: %{feed_id: feed.id, feed_url: feed.feed_url}
|
extra: %{feed_id: feed.id}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -184,8 +184,8 @@ defmodule Frenzy.UpdateFeeds do
|
||||||
Logger.error("Unable to parse feed at '#{feed.feed_url}': #{inspect(reason)}")
|
Logger.error("Unable to parse feed at '#{feed.feed_url}': #{inspect(reason)}")
|
||||||
|
|
||||||
if Frenzy.sentry_enabled?() do
|
if Frenzy.sentry_enabled?() do
|
||||||
Sentry.capture_message("Unable to parse feed: #{inspect(reason)}",
|
Sentry.capture_message("Unable to parse feed '#{feed.feed_url}': #{inspect(reason)}",
|
||||||
extra: %{feed_id: feed.id, feed_url: feed.feed_url}
|
extra: %{feed_id: feed.id}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue