From bea43aba33de850346f53c1e6ee310bbcf74746b Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 29 Dec 2022 19:42:14 +0000 Subject: [PATCH 1/2] Fix rel="me" Cachex for this was not started --- CHANGELOG.md | 2 ++ lib/pleroma/application.ex | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18da66e8b..c15546608 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixed +- rel="me" was missing its cache + ### Removed ## 2.5.0 - 2022-12-23 diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index 1c1db8c10..e68a3c57e 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -209,7 +209,8 @@ defmodule Pleroma.Application do build_cachex("chat_message_id_idempotency_key", expiration: chat_message_id_idempotency_key_expiration(), limit: 500_000 - ) + ), + build_cachex("rel_me", limit: 2500) ] end From 39e4b788ad657f0f63ed8c53848c805738115321 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 30 Dec 2022 15:36:21 -0500 Subject: [PATCH 2/2] Remove unwanted code specific to MIX_ENV=test --- lib/pleroma/web/rel_me.ex | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/pleroma/web/rel_me.ex b/lib/pleroma/web/rel_me.ex index 98fbc1c59..ceb6a05f0 100644 --- a/lib/pleroma/web/rel_me.ex +++ b/lib/pleroma/web/rel_me.ex @@ -9,17 +9,13 @@ defmodule Pleroma.Web.RelMe do recv_timeout: 2_000 ] - if Pleroma.Config.get(:env) == :test do - def parse(url) when is_binary(url), do: parse_url(url) - else - @cachex Pleroma.Config.get([:cachex, :provider], Cachex) - def parse(url) when is_binary(url) do - @cachex.fetch!(:rel_me_cache, url, fn _ -> - {:commit, parse_url(url)} - end) - rescue - e -> {:error, "Cachex error: #{inspect(e)}"} - end + @cachex Pleroma.Config.get([:cachex, :provider], Cachex) + def parse(url) when is_binary(url) do + @cachex.fetch!(:rel_me_cache, url, fn _ -> + {:commit, parse_url(url)} + end) + rescue + e -> {:error, "Cachex error: #{inspect(e)}"} end def parse(_), do: {:error, "No URL provided"}