https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35948 --- Comment #8 from Nick Clemens (kidclamp) <nick@bywatersolutions.com> --- Created attachment 199763 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199763&action=edit Bug 35948: Add jobs_unfinished_days and jobs_unfinished_type to cleanup_database.pl This patch adds two new parameters to control the deletion of background jobs that did not complete. Some libraries may want to keep a failed job longer than a completed one for debugging reasons. To test: 0 - Apply patch 1 - Make some old failed jobs: INSERT INTO background_jobs (status,type,enqueued_on) VALUES ('started','update_elastic_index','2020-01-01'), ('failed','update_elastic_index','2026-01-01'), ('started','other_type','2021-01-01'), ('failed','other_type','2026-01-01'); 2 - Confirm defaults of 365 and update_elastic_index for new params: perl misc/cronjobs/cleanup_database.pl -v --jobs-unfinished-days 3 - Should indicate 1 job older than 365 of type update_elastic_index would have been deleted 4 - Confirm days param works perl misc/cronjobs/cleanup_database.pl -v --jobs-unfinished-days 30 5 - Shoudl find 2 elastic jobs 6 - Confirm type param perl misc/cronjobs/cleanup_database.pl -v --jobs-unfinished-days --jobs-unfinished-type=other_type 7 - Should find 1 8 - Confirm type and days perl misc/cronjobs/cleanup_database.pl -v --jobs-unfinished-days 30 --jobs-unfinished-type=other_type 9 - Should find 2 10 - Confirm repeated type perl misc/cronjobs/cleanup_database.pl -v --jobs-unfinished-days=30 --jobs-unfinished-type=other_type --jobs-unfinished-type=update_elastic_index 11 - Finds 4 12 - Confirm deletion perl misc/cronjobs/cleanup_database.pl -v --jobs-unfinished-days=30 --jobs-unfinished-type=other_type --jobs-unfinished-type=update_elastic_index --confirm 13 - All your made up jobs are removed Signed-off-by: Trevor Diamond <trevor.diamond@mainlib.org> -- You are receiving this mail because: You are watching all bug changes.