WIP: Add backfilling of posts #846
2 changed files with 6 additions and 9 deletions
|
@ -1874,15 +1874,15 @@ def enqueue_outbox_fetches(
|
|||
# enqueue a task to fetch the outbox
|
||||
Logger.debug("Refetching outbox #{outbox_address}")
|
||||
|
||||
User.outbox_refreshed(user)
|
||||
|
||||
Pleroma.Workers.RemoteFetcherWorker.enqueue("fetch_outbox", %{
|
||||
"id" => outbox_address
|
||||
})
|
||||
|
||||
User.outbox_refreshed(user)
|
||||
|
||||
:ok
|
||||
else
|
||||
Logger.debug("Not refetching outbox (TTL not reached)")
|
||||
Logger.debug("Not refetching outbox (TTL not reached: #{last_fetch}, age #{NaiveDateTime.diff(NaiveDateTime.utc_now(), last_fetch)})")
|
||||
end
|
||||
|
||||
:ok
|
||||
|
@ -1891,7 +1891,8 @@ def enqueue_outbox_fetches(
|
|||
def enqueue_outbox_fetches(%{local: true}), do: :ok
|
||||
|
||||
def enqueue_outbox_fetches(%{local: false} = user) do
|
||||
# TODO: get outbox?
|
||||
make_user_from_ap_id(user.ap_id)
|
||||
:ok
|
||||
end
|
||||
|
||||
def make_user_from_ap_id(ap_id, additional \\ []) do
|
||||
|
|
|
@ -17,11 +17,7 @@ def perform(%Job{args: %{"op" => "fetch_outbox", "id" => address}}) do
|
|||
with {:ok, outbox} <- ActivityPub.fetch_and_prepare_collection_from_ap_id(address) do
|
||||
Enum.each(Enum.reverse(outbox), fn {ap_id, _} ->
|
||||
if is_nil(Object.get_cached_by_ap_id(ap_id)) do
|
||||
perform(%{
|
||||
"op" => "fetch_remote",
|
||||
"id" => ap_id,
|
||||
"depth" => 1
|
||||
})
|
||||
Fetcher.fetch_object_from_id(ap_id, depth: 1)
|
||||
end
|
||||
end)
|
||||
|
||||
|
|
Loading…
Reference in a new issue