only vacuum db if work was actually made

This commit is contained in:
Luna 2022-09-18 18:22:25 -03:00
parent 019c5ad1b5
commit f9547ff04c

View file

@ -192,6 +192,7 @@ async def main_with_ctx(ctx, wanted_date):
processed_ratio = new_processed_ratio processed_ratio = new_processed_ratio
log.info("tags done") log.info("tags done")
work_done = True
await ctx.db.commit() await ctx.db.commit()
@ -285,11 +286,13 @@ async def main_with_ctx(ctx, wanted_date):
processed_ratio = new_processed_ratio processed_ratio = new_processed_ratio
log.info("posts done") log.info("posts done")
work_done = True
await ctx.db.commit() await ctx.db.commit()
log.info("vacuuming db...") if work_done:
await ctx.db.execute("vacuum") log.info("vacuuming db...")
await ctx.db.execute("vacuum")
log.info("database built") log.info("database built")