From 5ba5df1321b8c177419ae5342d37bc524f8f6656 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 25 Nov 2018 21:20:29 +0000 Subject: [PATCH] object: normalize(): use object cache --- lib/pleroma/object.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/object.ex b/lib/pleroma/object.ex index 03a75dfbd..57a8b1d6b 100644 --- a/lib/pleroma/object.ex +++ b/lib/pleroma/object.ex @@ -27,8 +27,8 @@ def get_by_ap_id(ap_id) do Repo.one(from(object in Object, where: fragment("(?)->>'id' = ?", object.data, ^ap_id))) end - def normalize(obj) when is_map(obj), do: Object.get_by_ap_id(obj["id"]) - def normalize(ap_id) when is_binary(ap_id), do: Object.get_by_ap_id(ap_id) + def normalize(obj) when is_map(obj), do: normalize(obj["id"]) + def normalize(ap_id) when is_binary(ap_id), do: get_cached_by_ap_id(ap_id) def normalize(_), do: nil if Mix.env() == :test do