]> git.ipfire.org Git - dbl.git/commitdiff
lists: Manifest timestamps before optimizing
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 27 Feb 2026 14:05:52 +0000 (14:05 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 27 Feb 2026 14:05:52 +0000 (14:05 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/dbl/lists.py

index f097b8a550e70403f0cc834da5e1332ae346d11a..60a433e1c12ae1b206594453b86eb7dcf98edd41 100644 (file)
@@ -784,6 +784,9 @@ class List(sqlmodel.SQLModel, database.BackendMixin, table=True):
                """
                        Optimizes this list
                """
+               # Ensure that all timestamps have been manifested
+               await self.backend.db.flush_and_refresh(self)
+
                # Don't optimize if the list has not been changed
                if self.updated_at <= self.optimized_at:
                        log.debug("%s does not require optimization..." % self)
@@ -940,7 +943,6 @@ class List(sqlmodel.SQLModel, database.BackendMixin, table=True):
 
                # Mark as optimized
                self.updated_at = self.optimized_at = sqlmodel.func.current_timestamp()
-               await self.backend.db.flush_and_refresh(self)
 
                # Update all stats afterwards
                if update_stats: