data_privacy_task.rb 561 B

1234567891011121314151617181920212223
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. module MonitoringHelper
  3. class HealthChecker
  4. class DataPrivacyTask < Backend
  5. TIMEOUT = 30.minutes
  6. def run_health_check
  7. scope.find_each do |task|
  8. response.issues.push "Stuck data privacy task (ID #{task.id}) detected. Last update: #{task.updated_at}"
  9. end
  10. end
  11. private
  12. def scope
  13. ::DataPrivacyTask
  14. .where.not(state: 'completed')
  15. .where('updated_at <= ?', TIMEOUT.ago)
  16. end
  17. end
  18. end
  19. end