[Koha-bugs] [Bug 30350] Do not hardcode job types

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Mar 28 11:17:15 CEST 2022


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

Jonathan Druart <jonathan.druart+koha at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #132246|0                           |1
        is obsolete|                            |

--- Comment #4 from Jonathan Druart <jonathan.druart+koha at gmail.com> ---
Created attachment 132298
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132298&action=edit
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 <tomascohen at theke.io>

JD amended patch
-my @job_types = keys %{Koha::BackgroundJob::type_to_class_mapping};
+my @job_types = keys %{Koha::BackgroundJob::type_to_class_mapping()};
To remove the following error:
Ambiguous use of %{Koha::BackgroundJob::type_to_class_mapping} resolved to
%Koha::BackgroundJob::type_to_class_mapping
Signed-off-by: Jonathan Druart <jonathan.druart at bugs.koha-community.org>

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


More information about the Koha-bugs mailing list