Bugzilla – Attachment 144434 Details for
Bug 32395
Why do we send jobs params to the broker
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32395: Do not send job's parameters to the broker
Bug-32395-Do-not-send-jobs-parameters-to-the-broke.patch (text/plain), 2.63 KB, created by
Jonathan Druart
on 2022-12-06 09:31:05 UTC
(
hide
)
Description:
Bug 32395: Do not send job's parameters to the broker
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-12-06 09:31:05 UTC
Size:
2.63 KB
patch
obsolete
>From 5e57836b91596b9fc92dac7ab72f30217b86d940 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 6 Dec 2022 10:28:48 +0100 >Subject: [PATCH] Bug 32395: Do not send job's parameters to the broker > >--- > Koha/BackgroundJob.pm | 15 ++++++--------- > 1 file changed, 6 insertions(+), 9 deletions(-) > >diff --git a/Koha/BackgroundJob.pm b/Koha/BackgroundJob.pm >index 727bc3b2f7b..82539ed8cff 100644 >--- a/Koha/BackgroundJob.pm >+++ b/Koha/BackgroundJob.pm >@@ -105,8 +105,6 @@ sub enqueue { > > my $borrowernumber = (C4::Context->userenv) ? C4::Context->userenv->{number} : undef; > $job_context->{interface} = C4::Context->interface; >- my $json_context = $json->encode($job_context); >- my $json_args = $json->encode($job_args); > > $self->set( > { >@@ -114,15 +112,13 @@ sub enqueue { > type => $job_type, > queue => $job_queue, > size => $job_size, >- data => $json_args, >- context => $json_context, >+ data => $json->encode($job_args), >+ context => $json->encode($job_context), > enqueued_on => dt_from_string, > borrowernumber => $borrowernumber, > } > )->store; > >- $job_args->{job_id} = $self->id; >- > my $conn; > try { > $conn = $self->connect; >@@ -131,14 +127,15 @@ sub enqueue { > }; > return unless $conn; > >- $json_args = $json->encode($job_args); > try { > # This namespace is wrong, it must be a vhost instead. > # But to do so it needs to be created on the server => much more work when a new Koha instance is created. > # Also, here we just want the Koha instance's name, but it's not in the config... > # Picking a random id (memcached_namespace) from the config > my $namespace = C4::Context->config('memcached_namespace'); >- my $encoded_args = Encode::encode_utf8( $json_args ); # FIXME We should better leave this to Net::Stomp? >+ my $encoded_args = Encode::encode_utf8( >+ $json->encode( { job_id => $self->id } ) >+ ); # FIXME We should better leave this to Net::Stomp? > $conn->send_with_receipt( { destination => sprintf("/queue/%s-%s", $namespace, $job_queue), body => $encoded_args } ) > or Koha::Exceptions::Exception->throw('Job has not been enqueued'); > } catch { >@@ -166,7 +163,7 @@ sub process { > > my $derived_class = $self->_derived_class; > >- $args ||= {}; >+ $args ||= $self->json->decode($self->data); > > if ( $self->context ) { > my $context = $self->json->decode($self->context); >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 32395
: 144434