From: rinpatch Date: Wed, 16 Jan 2019 07:38:42 +0000 (+0300) Subject: Add a fallback function to handle generic params, just in case X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=a9c27e137d992c991827417af40fe49fafa34be2;p=akkoma Add a fallback function to handle generic params, just in case --- diff --git a/lib/pleroma/web/metadata.ex b/lib/pleroma/web/metadata.ex index bc0f3beed..23f152e06 100644 --- a/lib/pleroma/web/metadata.ex +++ b/lib/pleroma/web/metadata.ex @@ -20,6 +20,14 @@ defmodule Pleroma.Web.Metadata do end) end + def get_cached_tags(params) do + key = :erlang.term_to_binary(params) + + Cachex.fetch!(:metadata_cache, key, fn _key -> + {:commit, build_tags(params)} + end) + end + def build_tags(params) do Enum.reduce(@parsers, "", fn parser, acc -> rendered_html =