Add import cleanup

This commit is contained in:
Stanko K.R.
2026-02-02 12:34:39 +01:00
parent 5bbd7f633d
commit de69d2e6fe
3 changed files with 12 additions and 2 deletions
+2 -1
View File
@@ -628,6 +628,7 @@ GEM
railties
yabeda (~> 0.8)
zeitwerk (2.7.4)
zip_kit (6.3.4)
PLATFORMS
aarch64-linux
@@ -678,7 +679,6 @@ DEPENDENCIES
rouge
rqrcode
rubocop-rails-omakase
rubyzip
selenium-webdriver
sentry-rails
sentry-ruby
@@ -705,6 +705,7 @@ DEPENDENCIES
yabeda-prometheus-mmap
yabeda-puma-plugin
yabeda-rails
zip_kit
BUNDLED WITH
2.7.2
+7 -1
View File
@@ -8,6 +8,12 @@ class Account::Import < ApplicationRecord
enum :status, %w[ pending processing completed failed ].index_by(&:itself), default: :pending
scope :expired, -> { where(completed_at: ...24.hours.ago) }
def self.cleanup
expired.destroy_all
end
def process_later
ImportAccountDataJob.perform_later(self)
end
@@ -39,7 +45,7 @@ class Account::Import < ApplicationRecord
private
def mark_completed
completed!
update!(status: :completed, completed_at: Time.current)
ImportMailer.completed(identity, account).deliver_later
end
+3
View File
@@ -27,6 +27,9 @@ production: &production
cleanup_exports:
command: "Export.cleanup"
schedule: every hour at minute 20
cleanup_imports:
command: "Account::Import.cleanup"
schedule: every hour at minute 25
incineration:
class: "Account::IncinerateDueJob"
schedule: every 8 hours at minute 16