Do object insertion through Cachex
So we don't flood our postgres logs with errors. Should also make things slightly faster.
This commit is contained in:
parent
99fd199bda
commit
f8388be9c6
4 changed files with 53 additions and 19 deletions
|
|
@ -305,16 +305,8 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
|
|||
else
|
||||
_e ->
|
||||
changeset = Object.context_mapping(context)
|
||||
|
||||
case Repo.insert(changeset) do
|
||||
{:ok, %{id: id}} ->
|
||||
id
|
||||
|
||||
# This should be solved by an upsert, but it seems ecto
|
||||
# has problems accessing the constraint inside the jsonb.
|
||||
{:error, _} ->
|
||||
Object.get_cached_by_ap_id(context).id
|
||||
end
|
||||
{:ok, object} = Object.insert_or_get(changeset)
|
||||
object.id
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue