diff options
-rw-r--r-- | src/lib/Bcfg2/Reporting/models.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Reporting/models.py b/src/lib/Bcfg2/Reporting/models.py index c7850f4af..ab2dc8418 100644 --- a/src/lib/Bcfg2/Reporting/models.py +++ b/src/lib/Bcfg2/Reporting/models.py @@ -392,7 +392,13 @@ class BaseEntry(models.Model): @classmethod def prune_orphans(cls): '''Remove unused entries''' - cls.objects.filter(interaction__isnull=True).delete() + # yeat another sqlite hack + cls_orphans = [x['id'] \ + for x in cls.objects.filter(interaction__isnull=True).values("id")] + i = 0 + while i < len(cls_orphans): + cls.objects.filter(id__in=cls_orphans[i:i+100]).delete() + i += 100 class SuccessEntry(BaseEntry): |