Skip to content

Commit

Permalink
Improve/fix cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
tarpas committed May 30, 2023
1 parent 89cf74a commit d99dfa8
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions testmon/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ def finish_execution(self, exec_id, duration=None, select=True):
self.update_saving_stats(exec_id, select)
self.fetch_or_create_file_fp.cache_clear()
with self.con as con:
con.execute(
"""
DELETE FROM file_fp
self.vacuum_file_fp(con)

def vacuum_file_fp(self, con):
con.execute(
""" DELETE FROM file_fp
WHERE id NOT IN (
SELECT DISTINCT fingerprint_id FROM test_execution_file_fp
)
"""
)
SELECT DISTINCT fingerprint_id FROM test_execution_file_fp) """
)

def fetch_current_run_stats(self, exec_id):
with self.con as con:
Expand Down Expand Up @@ -276,10 +276,6 @@ def insert_test_file_fps(self, tests_deps_n_outcomes, exec_id=None):
test_execution_file_fps,
)
self.fetch_or_create_file_fp.cache_clear()
cursor.execute(
"DELETE FROM file_fp WHERE "
" id NOT IN (select fingerprint_id from test_execution_file_fp)"
)
self.insert_into_suite_files_fshas(con, exec_id, files_fshas)

def insert_into_suite_files_fshas(self, con, exec_id, files_fshas):
Expand Down

0 comments on commit d99dfa8

Please sign in to comment.