Bug 31970

Summary: background_jobs_purge.pl to purge background jobs queue
Product: Koha Reporter: Frédéric Demians <f.demians>
Component: Command-line UtilitiesAssignee: Bugs List <koha-bugs>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: dcook, robin
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 31970 - background_jobs_purge.pl to purge background jobs queue

Description Frédéric Demians 2022-10-25 11:25:21 UTC

    
Comment 1 Katrin Fischer 2022-10-25 11:32:33 UTC
Hi Frederic, i think this is a duplicate to a new bug from yesterday: bug 31969

*** This bug has been marked as a duplicate of bug 31969 ***
Comment 2 Frédéric Demians 2022-10-25 12:14:07 UTC
Created attachment 142609 [details] [review]
Bug 31970 - background_jobs_purge.pl to purge background jobs queue

With this script, you can see the state of the background jobs queue, finished
jobs only, and delete entries, globally, or by job type. Koha::BackgroundJob is
extended with a purge() method which could be used from Koha WUI.

TO TEST :

- On a Koha instance with a populated background_jobs table.
- Go in misc/cronjobs directory.
- ./background_jobs_purge.pl
  Display script usage. List of job's types is displayed.
- ./background_jobs_purge.pl all 2 --verbose
  Display a list of jobs (all types) to be deleted.
- ./background_jobs_purge.pl all 2 --verbose --confirm
  Display a list of jobs (all types) that have been deleted.
- ./background_jobs_purge.pl all 2 --verbose --confirm
  Display a message: No job to purge
- ./background_jobs_purge.pl update_elastic_index 0 -v
  Display a list of all update_elastic_index job
- ./background_jobs_purge.pl update_elastic_index 0 -v -c
  Display a list of all update_elastic_index job that have been
  delete. This could be run several time each day...
Comment 3 Frédéric Demians 2022-10-25 12:16:55 UTC
Katrin, yes, it is! Even it's a different approach.
Comment 4 Katrin Fischer 2022-10-25 21:11:57 UTC
Maybe you should post your patch as an alternate on bug 31969 so it's seen and highlight the differences. With the duplicate status it's now easy to miss and it looks like we should agree on one approach or the other :)
Comment 5 Frédéric Demians 2022-10-26 06:10:20 UTC
Thank you Katrin for your vigilance. Bug 31969 approach is fine for me, and it avoid adding a new script.