Execute session disconnect in background
This commit is contained in:
parent
f459c1260b
commit
a31d6bb52c
2 changed files with 15 additions and 3 deletions
|
@ -89,7 +89,8 @@ defmodule Pleroma.Application do
|
|||
Pleroma.Repo,
|
||||
Config.TransferTask,
|
||||
Pleroma.Emoji,
|
||||
Pleroma.Web.Plugs.RateLimiter.Supervisor
|
||||
Pleroma.Web.Plugs.RateLimiter.Supervisor,
|
||||
{Task.Supervisor, name: Pleroma.TaskSupervisor}
|
||||
] ++
|
||||
cachex_children() ++
|
||||
http_children(adapter, @mix_env) ++
|
||||
|
|
|
@ -21,7 +21,18 @@ defmodule Pleroma.Web.OAuth.Token.Strategy.Revoke do
|
|||
@doc "Revokes access token"
|
||||
@spec revoke(Token.t()) :: {:ok, Token.t()} | {:error, Ecto.Changeset.t()}
|
||||
def revoke(%Token{} = token) do
|
||||
Repo.delete(token)
|
||||
Pleroma.Web.Streamer.close_streams_by_oauth_token(token)
|
||||
with {:ok, token} <- Repo.delete(token) do
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue