1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.OAuth.Token.CleanWorker do
7 The module represents functions to clean an expired oauth tokens.
14 @interval Pleroma.Config.get(
15 [:oauth2, :clean_expired_tokens_interval],
20 alias Pleroma.Web.OAuth.Token
21 alias Pleroma.Workers.BackgroundWorker
23 defdelegate worker_args(queue), to: Pleroma.Workers.Helper
25 def start_link(_), do: GenServer.start_link(__MODULE__, %{})
28 Process.send_after(self(), :perform, @ten_seconds)
33 def handle_info(:perform, state) do
34 %{"op" => "clean_expired_tokens"}
35 |> BackgroundWorker.new(worker_args(:background))
38 Process.send_after(self(), :perform, @interval)
42 def perform(:clean), do: Token.delete_expired_tokens()