Class: HasHelpers::ServiceTrust::AuditLogCleanupWorker
- Inherits:
-
HasUtils::GoodJob::BaseWorker
- Object
- HasUtils::GoodJob::BaseWorker
- HasHelpers::ServiceTrust::AuditLogCleanupWorker
- Defined in:
- app/workers/has_helpers/service_trust/audit_log_cleanup_worker.rb
Instance Method Summary collapse
Instance Method Details
#perform ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'app/workers/has_helpers/service_trust/audit_log_cleanup_worker.rb', line 8 def perform cutoff = Time.current - HasHelpers::ServiceTrust.config.audit_log_retention loop do ids = AuditLog.where("occurred_at < ?", cutoff).limit(10_000).pluck(:id) break if ids.empty? AuditLog.where(id: ids).delete_all end end |