tasks.py 718 B

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