Bugzilla – Attachment 178068 Details for
Bug 34070
background_jobs_worker.pl floods logs when it gets error frames
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34070: WIP
Bug-34070-WIP.patch (text/plain), 2.74 KB, created by
David Cook
on 2025-02-14 02:47:15 UTC
(
hide
)
Description:
Bug 34070: WIP
Filename:
MIME Type:
Creator:
David Cook
Created:
2025-02-14 02:47:15 UTC
Size:
2.74 KB
patch
obsolete
>From 8f4795b9a7146752b63d6f70611691d84c0f1d6a Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Fri, 14 Feb 2025 02:39:28 +0000 >Subject: [PATCH] Bug 34070: WIP > >--- > Koha/BackgroundJob.pm | 8 ++++++-- > misc/workers/es_indexer_daemon.pl | 18 ++++++++++++++++-- > 2 files changed, 22 insertions(+), 4 deletions(-) > >diff --git a/Koha/BackgroundJob.pm b/Koha/BackgroundJob.pm >index 211e2e32f3..0ab3b4c4ee 100644 >--- a/Koha/BackgroundJob.pm >+++ b/Koha/BackgroundJob.pm >@@ -151,8 +151,12 @@ sub enqueue { > 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 $destination = sprintf( "/queue/%s-%s", $namespace, $job_queue ); >- $conn->send_with_receipt( { destination => $destination, body => $encoded_args, persistent => 'true' } ) >- or Koha::Exceptions::BackgroundJob->throw('Job has not been enqueued'); >+ $conn->send_with_receipt( >+ { >+ destination => $destination, body => $encoded_args, persistent => 'true', >+ 'content-type' => 'application/json' >+ } >+ ) or Koha::Exceptions::BackgroundJob->throw('Job has not been enqueued'); > } catch { > $self->status('failed')->store; > if ( ref($_) eq 'Koha::Exceptions::BackgroundJob' ) { >diff --git a/misc/workers/es_indexer_daemon.pl b/misc/workers/es_indexer_daemon.pl >index aa2f2a9db2..0565f9daef 100755 >--- a/misc/workers/es_indexer_daemon.pl >+++ b/misc/workers/es_indexer_daemon.pl >@@ -119,8 +119,22 @@ while (1) { > } > > my $args = try { >- my $body = $frame->body; >- decode_json($body); # TODO Should this be from_json? Check utf8 flag. >+ my $command = $frame->command; >+ my $body = $frame->body; >+ my $content_type = $frame->content_type; >+ if ( $command && $command eq 'MESSAGE' ) { >+ if ( $content_type && $content_type eq 'application/json' ) { >+ decode_json($body); # TODO Should this be from_json? Check utf8 flag. >+ } >+ } elsif ( $command && $command eq 'ERROR' ) { >+ >+ #Known errors: >+ #You must log in using CONNECT first >+ #"NACK" must include a valid "message-id" header >+ Koha::Logger->get( { interface => 'worker' } ) >+ ->warn( sprintf "Shutting down after receiving ERROR frame:\n%s\n", $frame->as_string ); >+ exit 1; >+ } > } catch { > Koha::Logger->get( { interface => 'worker' } )->warn( sprintf "Frame not processed - %s", $_ ); > return; >-- >2.39.5
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 34070
:
178068
|
179024
|
179025
|
179094
|
179095
|
179214
|
179215
|
179216
|
179217
|
179218
|
182570
|
182571
|
182572
|
182573
|
182574