Summary: | Do not hardcode job types | ||
---|---|---|---|
Product: | Koha | Reporter: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Component: | Architecture, internals, and plumbing | Assignee: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Status: | RESOLVED DUPLICATE | QA Contact: | Kyle M Hall (khall) <kyle> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | dcook, fridolin.somers, jonathan.druart, kyle, martin.renvoize |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27434 | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | --- | Documentation contact: | |
Documentation submission: | Text to go in the release notes: | ||
Version(s) released in: | Circulation function: | ||
Bug Depends on: | 30172 | ||
Bug Blocks: | |||
Attachments: |
Bug 30350: Avoid hardcoding job types in background_jobs_worker.pl
Bug 30350: Avoid hardcoding job types in background_jobs_worker.pl Bug 30350: Avoid hardcoding job types in background_jobs_worker.pl |
Description
Tomás Cohen Arazi (tcohen)
2022-03-24 14:04:39 UTC
Created attachment 132246 [details] [review] 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@theke.io> The point was to have different workers with different job types. (In reply to Jonathan Druart from comment #2) > The point was to have different workers with different job types. Yeah, I get it, but it is not implemented yet, right? Let's talk about it on monday :-D Created attachment 132298 [details] [review] 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@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@bugs.koha-community.org> Created attachment 132857 [details] [review] 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@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@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> I would like to take this out of the RM queue for now, as work on bug 27783 might make this require some changes. If someone (including me) finds this is still relevant, let's make it PQA again. Thanks Kyle! |