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:
Egor Kislitsyn 2020-04-22 19:00:08 +04:00
parent e7771424a8
commit 6db52c3b36
3 changed files with 6 additions and 6 deletions

View file

@ -35,7 +35,7 @@ defmodule Pleroma.Workers.BackgroundWorker do
_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 @@ defmodule Pleroma.Workers.BackgroundWorker do
_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

View file

@ -756,8 +756,8 @@ defmodule Pleroma.UserTest 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 @@ defmodule Pleroma.UserTest 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

View file

@ -116,7 +116,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest 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 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest 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