From de94c79e2fb03f15ffcd8e800bcefd288584e081 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 25 Mar 2022 10:02:59 -0300 Subject: [PATCH] Bug 30350: Avoid hardcoding job types in background_jobs_worker.pl Currently, background_jobs_worker.pl has a hardcoded list of jobs it can process. Koha::BackgroundJob already has a method that can be used to extract such list. Using it would avoid having to maintain two lists, and it would also make it easier to inject plugin tasks as well. To test: 1. Apply the patch 2. Restart the koha-worker 3. Run one of the batch operations that make use of the background jobs (I used batch item delete) => SUCCESS: Things work, no change 4. Sign off :-D Signed-off-by: Tomas Cohen Arazi --- misc/background_jobs_worker.pl | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/misc/background_jobs_worker.pl b/misc/background_jobs_worker.pl index 5a84d342ba..3032ee38d1 100755 --- a/misc/background_jobs_worker.pl +++ b/misc/background_jobs_worker.pl @@ -28,15 +28,7 @@ try { warn sprintf "Cannot connect to the message broker, the jobs will be processed anyway (%s)", $_; }; -my @job_types = qw( - batch_biblio_record_modification - batch_authority_record_modification - batch_item_record_modification - batch_biblio_record_deletion - batch_authority_record_deletion - batch_item_record_deletion - batch_hold_cancel -); +my @job_types = keys %{Koha::BackgroundJob::type_to_class_mapping}; if ( $conn ) { # FIXME cf note in Koha::BackgroundJob about $namespace -- 2.32.0