Bug 31969 changed cleanup_database.pl so it removes only finished background jobs. But old background jobs with other statuses will never be removed. I see no use to that
So we should use "enqueued_on" instead of "ended_on" and no filter on status
Created attachment 161646 [details] [review] Bug 35948: cleanup_database.pl should remove not only finished background jobs Bug 31969 changed cleanup_database.pl so it removes only finished background jobs. But old background jobs with other statuses will never be removed. So we should use "enqueued_on" instead of "ended_on" and no filter on status Test plan : 1) Create a background job with for example a batch item modification 2) Simulate ancien job via SQL : update background_jobs set status='failed',enqueued_on=DATE_SUB(NOW(),INTERVAL 10 DAY) where id=X 3) Run misc/cronjobs/cleanup_database.pl --jobs-days 9 --jobs-type all -v --confirm 4) Check the job is removed
Currently we have a lot of problems with jobs not finishing. Would this not only hide the problem? I feel it should be an option and not a change of behaviour.
@Fridolin: see bug 35092 What are the other "final" statues that should be cleaned? Certainly there should be "cancelled". And on the long run, "failed" also. Not sure about now because that might hide the current issues if --jobs-days is too small. But maybe it ok, I don't know.
Ah sure, cancelled is missing. I set status to needs discussion ;)
Anything else to cleanup besides cancelled and failed?