maintenance.py 371 B

123456789101112
  1. from datetime import timedelta
  2. from django.conf import settings
  3. from django.utils.timezone import now
  4. from .models import DebugSymbolBundle
  5. def cleanup_old_debug_symbol_bundles():
  6. days_ago = now() - timedelta(days=settings.GLITCHTIP_MAX_FILE_LIFE_DAYS)
  7. queryset = DebugSymbolBundle.objects.filter(last_used__lt=days_ago)
  8. queryset._raw_delete(queryset.db)