Clean chart hash map (#13611)

Clean chart hash map after 7 days (eventually to be removed)
This commit is contained in:
Stelios Fragkakis 2022-09-05 10:22:57 +03:00 committed by GitHub
parent c30ada7d80
commit 544aef1fde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -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;
}