[Koha-bugs] [Bug 31969] Options for cleanup_database.pl to remove finished jobs from the background job queue

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Oct 25 12:20:36 CEST 2022


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31969

--- Comment #2 from Björn Nylén <bjorn.nylen at ub.lu.se> ---
Bug 31969: Add background queue options to cleanup_database

    This patch adds background queue options to cleanup_database.pl to allow
    for purging completed background jobs.

    --bg-jobs DAYS Purge all finished background jobs this many days old.
Defaults to 1 if no DAYS provided.
    --bg-type TYPE What type of background job to purge. Defaults to
"update_elastic_index" if omitted
                   Specifying "all" will purge all types. Repeatable.

    To test:
     1 - Enable elastic search in Koha
     2 - perl misc/maintenance/touch_all_items.pl
     3 - Generate an number of diffrent types of bg-jobs (eg batch_hold_cancel,
         batch_biblio_record_deletion, batch_item_record_deletion)
     4 - Check db and note there are a bunch of diffrent jobs
     5 - Update to make them old
         UPDATE background_jobs SET enqued_on = '2022-10-01 00:00:00',
status='finished'
     6 - perl misc/cronjobs/cleanup_database.pl
     7 - Note bg-jobs entry shows in help
     8 - perl misc/cronjobs/cleanup_database.pl --bg-jobs 1 -v
     9 - Note that elasticqueue would have been cleared
    10 - perl misc/cronjobs/cleanup_database.pl --bg-jobs 1 -v --confirm
    11 - Note that number of entries deleted is reported
    12 - Attempt to clear other job types, including "all" eg
         perl misc/cronjobs/cleanup_database.pl --bg-jobs 1 --bg-type
batch_item_record_deletion  -v --confirm
         perl misc/cronjobs/cleanup_database.pl --bg-jobs 1 --bg-type all  -v
--confirm
    13 - Confirm in staff interface that jobs are gone:
         http://localhost:8081/cgi-bin/koha/admin/background_jobs.pl
         (Uncheck 'Current jobs only')

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list