diff options
author | Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> | 2022-09-05 10:22:57 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-05 10:22:57 +0300 |
commit | 544aef1fde6e79ac57d2dea85d3f063076d7f885 (patch) | |
tree | 2f9ad0d971936104f2afc20c818f1abfb57e9635 /database/sqlite | |
parent | c30ada7d8095257ca0117473a678964e43ad9436 (diff) |
Clean chart hash map (#13611)
Clean chart hash map after 7 days (eventually to be removed)
Diffstat (limited to 'database/sqlite')
-rw-r--r-- | database/sqlite/sqlite_aclk.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/database/sqlite/sqlite_aclk.c b/database/sqlite/sqlite_aclk.c index 941e302f74..b51ea317d3 100644 --- a/database/sqlite/sqlite_aclk.c +++ b/database/sqlite/sqlite_aclk.c @@ -1023,6 +1023,10 @@ void sql_check_aclk_table_list(struct aclk_database_worker_config *wc) } db_execute("DELETE FROM dimension_delete WHERE host_id NOT IN (SELECT host_id FROM host) " " OR unixepoch() - date_created > 604800;"); + + db_execute("DELETE FROM chart_hash WHERE CAST(last_used AS INT) < unixepoch() - 604800;"); + db_execute("DELETE FROM chart_hash_map WHERE hash_id NOT IN (SELECT hash_id FROM chart_hash);"); + return; } |