Add worker to clean obsolete application data, token revokation and spec conformance
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
32
lib/service/workers/clean_application_data.ex
Normal file
32
lib/service/workers/clean_application_data.ex
Normal file
@@ -0,0 +1,32 @@
|
||||
defmodule Mobilizon.Service.Workers.CleanApplicationData do
|
||||
@moduledoc """
|
||||
Worker to send activity recaps
|
||||
"""
|
||||
|
||||
use Oban.Worker, queue: "background"
|
||||
alias Mobilizon.Service.Auth.Applications
|
||||
require Logger
|
||||
|
||||
@impl Oban.Worker
|
||||
def perform(%Job{args: %{type: :application}}) do
|
||||
Logger.info("Cleaning expired applications data")
|
||||
|
||||
# TODO: Clear unused applications after a while
|
||||
end
|
||||
|
||||
@impl Oban.Worker
|
||||
def perform(%Job{args: %{type: :application_token}}) do
|
||||
Logger.info("Cleaning expired application tokens data")
|
||||
|
||||
Applications.prune_old_tokens()
|
||||
:ok
|
||||
end
|
||||
|
||||
@impl Oban.Worker
|
||||
def perform(%Job{args: %{type: :application_device_activation}}) do
|
||||
Logger.info("Cleaning expired application device activation data")
|
||||
|
||||
Applications.prune_old_application_device_activations()
|
||||
:ok
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user