Don't commit nil values in object cache.
authorRoger Braun <roger@rogerbraun.net>
Mon, 1 May 2017 14:28:40 +0000 (16:28 +0200)
committerRoger Braun <roger@rogerbraun.net>
Mon, 1 May 2017 14:28:40 +0000 (16:28 +0200)
lib/pleroma/object.ex

index 168843bd97a34e601594cc413e5c7f9172b9493a..949ccb0f66e172a6b4bece0983e55ef20fa52b8d 100644 (file)
@@ -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