insights: cleanup old completed/failed jobs in the DB
Created by: slimsag
Code insights enqueues a lot of jobs, specifically due to the historical data generation. In production and k8s.sgdev.org, it's rapidly approaching millions of jobs left in the DB in a completed state, e.g.:
sg=# select count(*) from insights_query_runner_jobs where state='completed';
count
--------
855658
(1 row)
This adds a background goroutine which periodically cleans those up so the DB does not get increasingly full.
Signed-off-by: Stephen Gutekanst [email protected]