mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-11-14 13:02:08 +00:00
Oban: change :discard return values to :cancel
:discard will be removed in Oban 3.0. It was only meant for internal use.
This commit is contained in:
parent
3754713599
commit
f52b229baa
5 changed files with 12 additions and 12 deletions
0
changelog.d/oban-deprecated-discards.skip
Normal file
0
changelog.d/oban-deprecated-discards.skip
Normal file
|
@ -123,9 +123,9 @@ defmodule Pleroma.Web.ActivityPub.Publisher do
|
||||||
Logger.error("Publisher failed to inbox #{inbox} with status #{code}")
|
Logger.error("Publisher failed to inbox #{inbox} with status #{code}")
|
||||||
|
|
||||||
case response do
|
case response do
|
||||||
%{status: 403} -> {:discard, :forbidden}
|
%{status: 403} -> {:cancel, :forbidden}
|
||||||
%{status: 404} -> {:discard, :not_found}
|
%{status: 404} -> {:cancel, :not_found}
|
||||||
%{status: 410} -> {:discard, :not_found}
|
%{status: 410} -> {:cancel, :not_found}
|
||||||
_ -> {:error, e}
|
_ -> {:error, e}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -14,16 +14,16 @@ defmodule Pleroma.Workers.RemoteFetcherWorker do
|
||||||
:ok
|
:ok
|
||||||
|
|
||||||
{:rejected, reason} ->
|
{:rejected, reason} ->
|
||||||
{:discard, reason}
|
{:cancel, reason}
|
||||||
|
|
||||||
{:error, :forbidden} ->
|
{:error, :forbidden} ->
|
||||||
{:discard, :forbidden}
|
{:cancel, :forbidden}
|
||||||
|
|
||||||
{:error, :not_found} ->
|
{:error, :not_found} ->
|
||||||
{:discard, :not_found}
|
{:cancel, :not_found}
|
||||||
|
|
||||||
{:error, :allowed_depth} ->
|
{:error, :allowed_depth} ->
|
||||||
{:discard, :allowed_depth}
|
{:cancel, :allowed_depth}
|
||||||
|
|
||||||
{:error, _} = e ->
|
{:error, _} = e ->
|
||||||
e
|
e
|
||||||
|
|
|
@ -223,7 +223,7 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
|
||||||
actor = insert(:user)
|
actor = insert(:user)
|
||||||
inbox = "http://404.site/users/nick1/inbox"
|
inbox = "http://404.site/users/nick1/inbox"
|
||||||
|
|
||||||
assert {:discard, _} =
|
assert {:cancel, _} =
|
||||||
Publisher.publish_one(%{inbox: inbox, json: "{}", actor: actor, id: 1})
|
Publisher.publish_one(%{inbox: inbox, json: "{}", actor: actor, id: 1})
|
||||||
|
|
||||||
assert called(Instances.set_unreachable(inbox))
|
assert called(Instances.set_unreachable(inbox))
|
||||||
|
|
|
@ -39,19 +39,19 @@ defmodule Pleroma.Workers.RemoteFetcherWorkerTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "does not requeue a deleted object" do
|
test "does not requeue a deleted object" do
|
||||||
assert {:discard, _} =
|
assert {:cancel, _} =
|
||||||
RemoteFetcherWorker.perform(%Oban.Job{
|
RemoteFetcherWorker.perform(%Oban.Job{
|
||||||
args: %{"op" => "fetch_remote", "id" => @deleted_object_one}
|
args: %{"op" => "fetch_remote", "id" => @deleted_object_one}
|
||||||
})
|
})
|
||||||
|
|
||||||
assert {:discard, _} =
|
assert {:cancel, _} =
|
||||||
RemoteFetcherWorker.perform(%Oban.Job{
|
RemoteFetcherWorker.perform(%Oban.Job{
|
||||||
args: %{"op" => "fetch_remote", "id" => @deleted_object_two}
|
args: %{"op" => "fetch_remote", "id" => @deleted_object_two}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
test "does not requeue an unauthorized object" do
|
test "does not requeue an unauthorized object" do
|
||||||
assert {:discard, _} =
|
assert {:cancel, _} =
|
||||||
RemoteFetcherWorker.perform(%Oban.Job{
|
RemoteFetcherWorker.perform(%Oban.Job{
|
||||||
args: %{"op" => "fetch_remote", "id" => @unauthorized_object}
|
args: %{"op" => "fetch_remote", "id" => @unauthorized_object}
|
||||||
})
|
})
|
||||||
|
@ -60,7 +60,7 @@ defmodule Pleroma.Workers.RemoteFetcherWorkerTest do
|
||||||
test "does not requeue an object that exceeded depth" do
|
test "does not requeue an object that exceeded depth" do
|
||||||
clear_config([:instance, :federation_incoming_replies_max_depth], 0)
|
clear_config([:instance, :federation_incoming_replies_max_depth], 0)
|
||||||
|
|
||||||
assert {:discard, _} =
|
assert {:cancel, _} =
|
||||||
RemoteFetcherWorker.perform(%Oban.Job{
|
RemoteFetcherWorker.perform(%Oban.Job{
|
||||||
args: %{"op" => "fetch_remote", "id" => @depth_object, "depth" => 1}
|
args: %{"op" => "fetch_remote", "id" => @depth_object, "depth" => 1}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue