Skip to content

Commit

Permalink
free up database after removing data
Browse files Browse the repository at this point in the history
  • Loading branch information
kcubeterm committed Jun 19, 2022
1 parent 5dc8973 commit e7ce2db
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion achoz/central_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down Expand Up @@ -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


Expand Down

0 comments on commit e7ce2db

Please sign in to comment.