OAuth token cleanup: Get rid of compile-time configuration

This commit is contained in:
rinpatch 2019-12-08 17:36:44 +03:00
parent af5fef1f22
commit bd3aa8500c
2 changed files with 3 additions and 6 deletions

View file

@ -82,6 +82,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Report emails now include functional links to profiles of remote user accounts - Report emails now include functional links to profiles of remote user accounts
- Not being able to log in to some third-party apps when logged in to MastoFE - Not being able to log in to some third-party apps when logged in to MastoFE
- MRF: `Delete` activities being exempt from MRF policies - MRF: `Delete` activities being exempt from MRF policies
- OTP releases: Not being able to configure OAuth expired token cleanup interval
<details> <details>
<summary>API Changes</summary> <summary>API Changes</summary>

View file

@ -11,11 +11,6 @@ defmodule Pleroma.Web.OAuth.Token.CleanWorker do
@ten_seconds 10_000 @ten_seconds 10_000
@one_day 86_400_000 @one_day 86_400_000
@interval Pleroma.Config.get(
[:oauth2, :clean_expired_tokens_interval],
@one_day
)
alias Pleroma.Web.OAuth.Token alias Pleroma.Web.OAuth.Token
alias Pleroma.Workers.BackgroundWorker alias Pleroma.Workers.BackgroundWorker
@ -29,8 +24,9 @@ defmodule Pleroma.Web.OAuth.Token.CleanWorker do
@doc false @doc false
def handle_info(:perform, state) do def handle_info(:perform, state) do
BackgroundWorker.enqueue("clean_expired_tokens", %{}) BackgroundWorker.enqueue("clean_expired_tokens", %{})
interval = Pleroma.Config.get([:oauth2, :clean_expired_tokens_interval], @one_day)
Process.send_after(self(), :perform, @interval) Process.send_after(self(), :perform, interval)
{:noreply, state} {:noreply, state}
end end