1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 09:26:03 +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

@ -367,6 +367,12 @@ class ScheduleTests(TransactionTestCase):
schedule.retain()
self.assertEqual(self.deletes()[-1].params["backup"], str(older.uuid))
def test_retention_reads_each_vm_once(self):
self.backups(*[Backup.READY] * 4)
with patch("vmbackups.schedule.beyond_keep", return_value=[]) as beyond:
schedule.retain()
self.assertEqual(beyond.call_count, 1)
def chained(self, *backups):
for parent, child in zip(backups, backups[1:]):
Backup.objects.filter(pk=child.pk).update(parent=parent)