From: Roger Braun Date: Mon, 1 May 2017 14:28:40 +0000 (+0200) Subject: Don't commit nil values in object cache. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=108573265aaf237a37937544c3f416b85f57e0fb;p=akkoma Don't commit nil values in object cache. --- diff --git a/lib/pleroma/object.ex b/lib/pleroma/object.ex index 168843bd9..949ccb0f6 100644 --- a/lib/pleroma/object.ex +++ b/lib/pleroma/object.ex @@ -19,7 +19,14 @@ defmodule Pleroma.Object do get_by_ap_id(ap_id) else key = "object:#{ap_id}" - Cachex.get!(:user_cache, key, fallback: fn(_) -> get_by_ap_id(ap_id) end) + Cachex.get!(:user_cache, key, fallback: fn(_) -> + object = get_by_ap_id(ap_id) + if object do + {:commit, object} + else + {:ignore, object} + end + end) end end