OAuth token cleanup: Get rid of compile-time configuration
This commit is contained in:
parent
af5fef1f22
commit
bd3aa8500c
|
@ -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>
|
||||||
|
|
||||||
|
|
|
@ -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 @@ def init(_) 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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue