1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00

fix(vmbackups): eighth audit: retention reads each VM once, no reload while typing

- The backups' default ordering put created_at into the SELECT DISTINCT
  of the retention pass and of the checkpoint pruning, so a VM came once
  per backup: the pass read every backup's chain again. The ordering is
  cleared before both.
- A page with a backup being made or deleted reloads every 4 s; it now
  waits while a field is focused, so a filter or the backup form being
  filled in is not lost.
This commit is contained in:
catborise 2026-11-18 15:53:18 +03:00
parent 348628f13d
commit 810abe7475
4 changed files with 10 additions and 4 deletions

View file

@ -150,7 +150,7 @@ def retain():
if policy.target_id in tried or not _active_superuser(policy.owner):
continue
vms = (Backup.objects.filter(policy=policy, state=Backup.READY, instance__isnull=False)
.values_list("instance_id", flat=True).distinct())
.order_by().values_list("instance_id", flat=True).distinct()) # no created_at in the distinct
for instance_id in vms:
# a chain goes when all of it is beyond keep, newest first: only a backup nothing builds on is deleted
beyond = [b for b in beyond_keep(policy, instance_id) if not b.depended_on()]