mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-22 08:06:55 +00:00
Skip refetching poll results if the object's updated_at is newer than the poll closed timestamp
This commit is contained in:
parent
c077a14ce1
commit
4b3f604f95
1 changed files with 3 additions and 0 deletions
|
@ -32,6 +32,8 @@ defmodule Pleroma.Workers.PollWorker do
|
|||
def perform(%Job{args: %{"op" => "refresh", "activity_id" => activity_id}}) do
|
||||
with {_, %Activity{object: object}} <-
|
||||
{:activity, Activity.get_by_id_with_object(activity_id)},
|
||||
{:ok, naive_closed} <- NaiveDateTime.from_iso8601(object.data["closed"]),
|
||||
{_, :lt} <- {:closed_compare, NaiveDateTime.compare(object.updated_at, naive_closed)},
|
||||
{_, {:ok, _object}} <- {:refetch, Fetcher.refetch_object(object)} do
|
||||
stream_update(activity_id)
|
||||
|
||||
|
@ -39,6 +41,7 @@ defmodule Pleroma.Workers.PollWorker do
|
|||
else
|
||||
{:activity, nil} -> {:cancel, :poll_activity_not_found}
|
||||
{:refetch, _} = e -> {:cancel, e}
|
||||
{:closed_compare, _} -> {:cancel, :poll_finalized}
|
||||
e -> {:error, e}
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue