Fix Oban warning
Warning example: [warn] Expected Elixir.Pleroma.Workers.BackgroundWorker.perform/2 to return :ok, {:ok, value}, or {:error, reason}. Instead received: [error: "not found @user@server.party", error: "not found "] The job will be considered a success.
This commit is contained in:
parent
e7771424a8
commit
6db52c3b36
|
@ -35,7 +35,7 @@ def perform(
|
||||||
_job
|
_job
|
||||||
) do
|
) do
|
||||||
blocker = User.get_cached_by_id(blocker_id)
|
blocker = User.get_cached_by_id(blocker_id)
|
||||||
User.perform(:blocks_import, blocker, blocked_identifiers)
|
{:ok, User.perform(:blocks_import, blocker, blocked_identifiers)}
|
||||||
end
|
end
|
||||||
|
|
||||||
def perform(
|
def perform(
|
||||||
|
@ -47,7 +47,7 @@ def perform(
|
||||||
_job
|
_job
|
||||||
) do
|
) do
|
||||||
follower = User.get_cached_by_id(follower_id)
|
follower = User.get_cached_by_id(follower_id)
|
||||||
User.perform(:follow_import, follower, followed_identifiers)
|
{:ok, User.perform(:follow_import, follower, followed_identifiers)}
|
||||||
end
|
end
|
||||||
|
|
||||||
def perform(%{"op" => "media_proxy_preload", "message" => message}, _job) do
|
def perform(%{"op" => "media_proxy_preload", "message" => message}, _job) do
|
||||||
|
|
|
@ -756,8 +756,8 @@ test "it imports user followings from list" do
|
||||||
]
|
]
|
||||||
|
|
||||||
{:ok, job} = User.follow_import(user1, identifiers)
|
{:ok, job} = User.follow_import(user1, identifiers)
|
||||||
result = ObanHelpers.perform(job)
|
|
||||||
|
|
||||||
|
assert {:ok, result} = ObanHelpers.perform(job)
|
||||||
assert is_list(result)
|
assert is_list(result)
|
||||||
assert result == [user2, user3]
|
assert result == [user2, user3]
|
||||||
end
|
end
|
||||||
|
@ -979,8 +979,8 @@ test "it imports user blocks from list" do
|
||||||
]
|
]
|
||||||
|
|
||||||
{:ok, job} = User.blocks_import(user1, identifiers)
|
{:ok, job} = User.blocks_import(user1, identifiers)
|
||||||
result = ObanHelpers.perform(job)
|
|
||||||
|
|
||||||
|
assert {:ok, result} = ObanHelpers.perform(job)
|
||||||
assert is_list(result)
|
assert is_list(result)
|
||||||
assert result == [user2, user3]
|
assert result == [user2, user3]
|
||||||
end
|
end
|
||||||
|
|
|
@ -116,7 +116,7 @@ test "it imports follows with different nickname variations", %{conn: conn} do
|
||||||
|> json_response(:ok)
|
|> json_response(:ok)
|
||||||
|
|
||||||
assert response == "job started"
|
assert response == "job started"
|
||||||
assert [job_result] = ObanHelpers.perform_all()
|
assert [{:ok, job_result}] = ObanHelpers.perform_all()
|
||||||
assert job_result == [user2, user3, user4, user5, user6]
|
assert job_result == [user2, user3, user4, user5, user6]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -180,7 +180,7 @@ test "it imports blocks with different nickname variations", %{conn: conn} do
|
||||||
|> json_response(:ok)
|
|> json_response(:ok)
|
||||||
|
|
||||||
assert response == "job started"
|
assert response == "job started"
|
||||||
assert [job_result] = ObanHelpers.perform_all()
|
assert [{:ok, job_result}] = ObanHelpers.perform_all()
|
||||||
assert job_result == [user2, user3, user4, user5, user6]
|
assert job_result == [user2, user3, user4, user5, user6]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue