Execute session disconnect in background
This commit is contained in:
parent
f459c1260b
commit
a31d6bb52c
@ -89,7 +89,8 @@ defmodule Pleroma.Application do
|
|||||||
Pleroma.Repo,
|
Pleroma.Repo,
|
||||||
Config.TransferTask,
|
Config.TransferTask,
|
||||||
Pleroma.Emoji,
|
Pleroma.Emoji,
|
||||||
Pleroma.Web.Plugs.RateLimiter.Supervisor
|
Pleroma.Web.Plugs.RateLimiter.Supervisor,
|
||||||
|
{Task.Supervisor, name: Pleroma.TaskSupervisor}
|
||||||
] ++
|
] ++
|
||||||
cachex_children() ++
|
cachex_children() ++
|
||||||
http_children(adapter, @mix_env) ++
|
http_children(adapter, @mix_env) ++
|
||||||
|
@ -21,7 +21,18 @@ defmodule Pleroma.Web.OAuth.Token.Strategy.Revoke do
|
|||||||
@doc "Revokes access token"
|
@doc "Revokes access token"
|
||||||
@spec revoke(Token.t()) :: {:ok, Token.t()} | {:error, Ecto.Changeset.t()}
|
@spec revoke(Token.t()) :: {:ok, Token.t()} | {:error, Ecto.Changeset.t()}
|
||||||
def revoke(%Token{} = token) do
|
def revoke(%Token{} = token) do
|
||||||
Repo.delete(token)
|
with {:ok, token} <- Repo.delete(token) do
|
||||||
Pleroma.Web.Streamer.close_streams_by_oauth_token(token)
|
Task.Supervisor.start_child(
|
||||||
|
Pleroma.TaskSupervisor,
|
||||||
|
Pleroma.Web.Streamer,
|
||||||
|
:close_streams_by_oauth_token,
|
||||||
|
[token],
|
||||||
|
restart: :transient
|
||||||
|
)
|
||||||
|
|
||||||
|
{:ok, token}
|
||||||
|
else
|
||||||
|
result -> result
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user