Merge branch 'refactor/use-job-queue-everywhere' into 'develop'
use job queue everywhere Closes #862 See merge request pleroma/pleroma!1142
This commit is contained in:
commit
692919c7d2
4 changed files with 89 additions and 55 deletions
|
|
@ -309,8 +309,13 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
|
|||
Enum.map(lines, fn line ->
|
||||
String.split(line, ",") |> List.first()
|
||||
end)
|
||||
|> List.delete("Account address"),
|
||||
{:ok, _} = Task.start(fn -> User.follow_import(follower, followed_identifiers) end) do
|
||||
|> List.delete("Account address") do
|
||||
PleromaJobQueue.enqueue(:background, User, [
|
||||
:follow_import,
|
||||
follower,
|
||||
followed_identifiers
|
||||
])
|
||||
|
||||
json(conn, "job started")
|
||||
end
|
||||
end
|
||||
|
|
@ -320,8 +325,13 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
|
|||
end
|
||||
|
||||
def blocks_import(%{assigns: %{user: blocker}} = conn, %{"list" => list}) do
|
||||
with blocked_identifiers <- String.split(list),
|
||||
{:ok, _} = Task.start(fn -> User.blocks_import(blocker, blocked_identifiers) end) do
|
||||
with blocked_identifiers <- String.split(list) do
|
||||
PleromaJobQueue.enqueue(:background, User, [
|
||||
:blocks_import,
|
||||
blocker,
|
||||
blocked_identifiers
|
||||
])
|
||||
|
||||
json(conn, "job started")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue