Skip to content
Snippets Groups Projects
Commit 487c00d3 authored by kaniini's avatar kaniini
Browse files

rich media: disable cachex in test mode

parent 0964c207
Branches emoji-reaction-fixie-fixes-uwu
No related tags found
No related merge requests found
defmodule Pleroma.Web.RichMedia.Parser do
@parsers [Pleroma.Web.RichMedia.Parsers.OGP]
def parse(url) do
Cachex.fetch!(:rich_media_cache, url, fn _ ->
{:ok, %Tesla.Env{body: html}} = Pleroma.HTTP.get(url)
if Mix.env() == :test do
def parse(url), do: parse_url(url)
else
def parse(url),
do: {:commit, Cachex.fetch!(:rich_media_cache, url, fn _ -> parse_url(url) end)}
end
result = html |> maybe_parse() |> get_parsed_data()
defp parse_url(url) do
{:ok, %Tesla.Env{body: html}} = Pleroma.HTTP.get(url)
{:commit, result}
end)
html |> maybe_parse() |> get_parsed_data()
end
defp maybe_parse(html) do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment