From e7ce2db2daee8166732dbd3bee36a2c3db396fb4 Mon Sep 17 00:00:00 2001 From: kcubeterm Date: Sun, 19 Jun 2022 15:15:46 +0530 Subject: [PATCH] free up database after removing data --- achoz/central_controller.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/achoz/central_controller.py b/achoz/central_controller.py index 91e843d..bc403f6 100644 --- a/achoz/central_controller.py +++ b/achoz/central_controller.py @@ -145,7 +145,17 @@ def Invoke_web_server_script(): started = True return started - +def vacuum_db(): + global_var.logger.debug('VACCUUM DB') + if not global_var.db_locked: + global_var.db_locked = True + db_con = sqlite3.connect(os.path.join(global_var.data_dir,'metadata.db')) + db = db_con.cursor() + db.execute("VACUUM;") + db.close() + global_var.db_locked = False + + return def remove_processed_data(): global_var.logger.debug('REMOVE PROCESSED DATA FUNC INVOKED') """it will regularly removes crawled file once it has indexed.""" @@ -173,6 +183,7 @@ def delete_row(ids:list): db.close() global_var.db_locked = False global_var.logger.debug('REMOVE PROCESSED DATA FUNC EXITED') + vacuum_db() return