From f9547ff04cc79b27500ca45e041cb83a84ce01ed Mon Sep 17 00:00:00 2001 From: Luna Date: Sun, 18 Sep 2022 18:22:25 -0300 Subject: [PATCH] only vacuum db if work was actually made --- build_database.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build_database.py b/build_database.py index 8eb933f..c500c35 100644 --- a/build_database.py +++ b/build_database.py @@ -192,6 +192,7 @@ async def main_with_ctx(ctx, wanted_date): processed_ratio = new_processed_ratio log.info("tags done") + work_done = True await ctx.db.commit() @@ -285,11 +286,13 @@ async def main_with_ctx(ctx, wanted_date): processed_ratio = new_processed_ratio log.info("posts done") + work_done = True await ctx.db.commit() - log.info("vacuuming db...") - await ctx.db.execute("vacuum") + if work_done: + log.info("vacuuming db...") + await ctx.db.execute("vacuum") log.info("database built")