tasks.py 581 B

12345678910111213141516171819
  1. from celery import shared_task
  2. from django.core.management import call_command
  3. from apps.files.tasks import cleanup_old_files
  4. from apps.issue_events.maintenance import cleanup_old_issues
  5. from apps.performance.tasks import cleanup_old_transaction_events
  6. from apps.uptime.tasks import cleanup_old_monitor_checks
  7. @shared_task
  8. def perform_maintenance():
  9. """
  10. Update postgres partitions and delete old data
  11. """
  12. call_command("pgpartition", yes=True)
  13. cleanup_old_transaction_events()
  14. cleanup_old_monitor_checks()
  15. cleanup_old_files()
  16. cleanup_old_issues()