1
0
Fork 0
forked from gitea/nas
nas/app/lib/vacuum/ng_histories_vacuum.rb
KMY(雪あすか) b2acc7dbb8
Add: #581 NGワード検出履歴を定期的に削除する処理 (#619)
* Add: #581 NGワード検出履歴を定期的に削除する処理

* マイグレーションコードを修正
2024-02-28 08:34:47 +09:00

18 lines
397 B
Ruby

# frozen_string_literal: true
class Vacuum::NgHistoriesVacuum
include Redisable
HISTORY_LIFE_DURATION = 7.days.freeze
def perform
vacuum_histories!
end
private
def vacuum_histories!
NgwordHistory.where('created_at < ?', HISTORY_LIFE_DURATION.ago).in_batches.destroy_all
NgRuleHistory.where('created_at < ?', HISTORY_LIFE_DURATION.ago).in_batches.destroy_all
end
end