Bugzilla – Attachment 156579 Details for
Bug 34990
Backgroundjob->enqueue does not send persistent header
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34990: Add persistent header when sending msg to RabbitMQ
Bug-34990-Add-persistent-header-when-sending-msg-t.patch (text/plain), 2.16 KB, created by
David Nind
on 2023-10-05 17:58:08 UTC
(
hide
)
Description:
Bug 34990: Add persistent header when sending msg to RabbitMQ
Filename:
MIME Type:
Creator:
David Nind
Created:
2023-10-05 17:58:08 UTC
Size:
2.16 KB
patch
obsolete
>From b5a898090d6084b1e7d4089dc2ac4ba4fd2b8186 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 5 Oct 2023 09:56:30 +0000 >Subject: [PATCH] Bug 34990: Add persistent header when sending msg to RabbitMQ > >Test plan: >NOTE: It is very hard to add a Koha unit test for adding this >single header when communicating to RabbitMQ via Stomp plugin. >When we would mock the send, we are only testing if perl can >pass a hashref to a subroutine ;) > >Do NOT yet apply this patch. >Make sure that RabbitMQ runs. >Stop the koha-worker for long_tasks: > koha-worker --stop --queue long_tasks myclone >Stage a MARC file. >Check queues with rabbitmqctl list_queues. >Look for: koha_myclone-long_tasks 1 (at least 1) >Stop rabbitmq (something like /etc/init.d/rabbitmq-server stop) >Start rabbitmq (/etc/init.d/rabbitmq-server start) >Check queue again with with rabbitmqctl list_queues. >Look for: koha_myclone-long_tasks 0 >Your messages have been gone. > >Now apply this patch. >Reiterate the former steps. But note that you will still see >a non-empty queue in the last step: >koha_myclone-long_tasks 1 (at least 1) > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/BackgroundJob.pm | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/Koha/BackgroundJob.pm b/Koha/BackgroundJob.pm >index f803c36b05..ca3f471be8 100644 >--- a/Koha/BackgroundJob.pm >+++ b/Koha/BackgroundJob.pm >@@ -138,7 +138,8 @@ sub enqueue { > # 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? >- $conn->send_with_receipt( { destination => sprintf("/queue/%s-%s", $namespace, $job_queue), body => $encoded_args } ) >+ my $destination = sprintf( "/queue/%s-%s", $namespace, $job_queue ); >+ $conn->send_with_receipt( { destination => $destination, body => $encoded_args, persistent => 'true' } ) > or Koha::Exceptions::Exception->throw('Job has not been enqueued'); > } catch { > $self->status('failed')->store; >-- >2.30.2
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 34990
:
156564
|
156579
|
156871