OAuth token cleanup: Get rid of compile-time configuration
authorrinpatch <rinpatch@sdf.org>
Sun, 8 Dec 2019 14:36:44 +0000 (17:36 +0300)
committerrinpatch <rinpatch@sdf.org>
Sun, 8 Dec 2019 17:03:33 +0000 (20:03 +0300)
CHANGELOG.md
lib/pleroma/web/oauth/token/clean_worker.ex

index d000977482f42fed2265c1a57193aa688ed28843..bb1f48a28f94fda841316ac1e85f1268a7d38002 100644 (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
 - Not being able to log in to some third-party apps when logged in to MastoFE
 - MRF: `Delete` activities being exempt from MRF policies
+- OTP releases: Not being able to configure OAuth expired token cleanup interval
 <details>
   <summary>API Changes</summary>
 
index f639f9c6fd202c38ea753c9336192700df93ddc2..3c9c580d51f1870ed5810709fe477f7f0726faea 100644 (file)
@@ -11,11 +11,6 @@ defmodule Pleroma.Web.OAuth.Token.CleanWorker do
   @ten_seconds 10_000
   @one_day 86_400_000
 
-  @interval Pleroma.Config.get(
-              [:oauth2, :clean_expired_tokens_interval],
-              @one_day
-            )
-
   alias Pleroma.Web.OAuth.Token
   alias Pleroma.Workers.BackgroundWorker
 
@@ -29,8 +24,9 @@ defmodule Pleroma.Web.OAuth.Token.CleanWorker do
   @doc false
   def handle_info(:perform, state) do
     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}
   end