projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Alternative implementation of hashtag-filtering queries in ActivityPub. Fixed GROUP...
[akkoma]
/
lib
/
pleroma
/
workers
/
purge_expired_token.ex
diff --git
a/lib/pleroma/workers/purge_expired_token.ex
b/lib/pleroma/workers/purge_expired_token.ex
index 6068e43bfbd6fc4dff9af20b0fb6e07546e6a2a1..a81e0cd28b1b88fe9793afd7a626baa8614e30eb 100644
(file)
--- a/
lib/pleroma/workers/purge_expired_token.ex
+++ b/
lib/pleroma/workers/purge_expired_token.ex
@@
-2,14
+2,14
@@
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
-defmodule Pleroma.Workers.PurgeExpired
OAuth
Token do
+defmodule Pleroma.Workers.PurgeExpiredToken do
@moduledoc """
Worker which purges expired OAuth tokens
"""
@moduledoc """
Worker which purges expired OAuth tokens
"""
- use Oban.Worker, queue: :
oauth_
token_expiration, max_attempts: 1
+ use Oban.Worker, queue: :token_expiration, max_attempts: 1
- @spec enqueue(%{token_id: integer(), valid_until: DateTime.t()}) ::
+ @spec enqueue(%{token_id: integer(), valid_until: DateTime.t()
, mod: module()
}) ::
{:ok, Oban.Job.t()} | {:error, Ecto.Changeset.t()}
def enqueue(args) do
{scheduled_at, args} = Map.pop(args, :valid_until)
{:ok, Oban.Job.t()} | {:error, Ecto.Changeset.t()}
def enqueue(args) do
{scheduled_at, args} = Map.pop(args, :valid_until)
@@
-20,8
+20,9
@@
defmodule Pleroma.Workers.PurgeExpiredOAuthToken do
end
@impl true
end
@impl true
- def perform(%Oban.Job{args: %{"token_id" => id}}) do
- Pleroma.Web.OAuth.Token
+ def perform(%Oban.Job{args: %{"token_id" => id, "mod" => module}}) do
+ module
+ |> String.to_existing_atom()
|> Pleroma.Repo.get(id)
|> Pleroma.Repo.delete()
end
|> Pleroma.Repo.get(id)
|> Pleroma.Repo.delete()
end