mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 10:01:41 +00:00
feat: realizar la limpieza en segundo plano
This commit is contained in:
parent
69c5d8d7bb
commit
4442338a68
2 changed files with 9 additions and 3 deletions
8
app/jobs/cleanup_job.rb
Normal file
8
app/jobs/cleanup_job.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Realiza tareas de limpieza en segundo plano
|
||||
class CleanupJob < ApplicationJob
|
||||
def perform(before = nil)
|
||||
CleanupService.new(before: before).cleanup_everything!
|
||||
end
|
||||
end
|
|
@ -4,8 +4,6 @@ namespace :cleanup do
|
|||
desc 'Cleanup sites'
|
||||
task everything: :environment do
|
||||
before = ENV.fetch('BEFORE', '30').to_i.days.ago
|
||||
service = CleanupService.new(before: before)
|
||||
|
||||
service.cleanup_everything!
|
||||
CleanupJob.perform_later(before)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue