[Koha-bugs] [Bug 27434] Task Scheduler should use classes as job types
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Fri Jan 15 00:40:40 CET 2021
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27434
--- Comment #2 from David Cook <dcook at prosentient.com.au> ---
Comment on attachment 115164
--> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=115164
Bug 27434: POC
Review of attachment 115164:
--> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=27434&attachment=115164)
-----------------------------------------------------------------
::: Koha/BackgroundJob.pm
@@ +137,4 @@
> my ( $self, $args ) = @_;
>
> my $job_type = $self->type;
> + my $class = "Koha::BackgroundJob::${job_type}";
I'd suggest $job_type actually contain the whole
"Koha::BackgroundJob::BatchUpdateBiblio". I think that would be more
powerful/flexible. It could also make for fewer typos.
::: Koha/BackgroundJob/BatchUpdateAuthority.pm
@@ +43,4 @@
> =cut
>
> sub job_type {
> + return 'BatchUpdateAuthority';
If we actually use the entire Koha::BackgroundJob::BatchUpdateAuthority string
for the job_type, then we could replace this with 'return __PACKAGE__;'
::: misc/background_jobs_worker.pl
@@ +28,5 @@
> warn sprintf "Cannot connect to the message broker, the jobs will be processed anyway (%s)", $_;
> };
>
> +# FIXME Job types should be stored in a table so that plugins can register new job types as well
> +my @job_types = qw( BatchUpdateBiblio BatchUpdateAuthority );
Honestly, I don't think that we actually even need to store job_types.
Something that could be interesting though is specifying what queues the
background_jobs_worker.pl will subscribe to.
This could be useful in terms of future scaling of workers. For instance, you
might want only 1 worker for a lot of background tasks, but you might want a
few for particularly busy queues.
--
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
More information about the Koha-bugs
mailing list