[Koha-bugs] [Bug 32393] background job worker explodes if JSON is incorrect

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Jan 24 13:30:39 CET 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32393

Marcel de Rooy <m.de.rooy at rijksmuseum.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Signed Off                  |Patch doesn't apply

--- Comment #37 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
Applying: Bug 32393: Prevent invalid job to block the job queue
Using index info to reconstruct a base tree...
M       misc/background_jobs_worker.pl
Falling back to patching base and 3-way merge...
Auto-merging misc/background_jobs_worker.pl
CONFLICT (content): Merge conflict in misc/background_jobs_worker.pl

++<<<<<<< HEAD
 +        my $body = $frame->body;
 +        my $args = decode_json($body); # TODO Should this be from_json? Check
utf8 flag.
 +
 +        # FIXME This means we need to have create the DB entry before
 +        # It could work in a first step, but then we will want to handle job
that will be created from the message received
 +        my $job = Koha::BackgroundJobs->find($args->{job_id});
 +
 +        $conn->ack( { frame => $frame } ); # Acknowledge the message was
received
 +        process_job( $job, $args );
++=======
+         my $job;
+         try {
+             my $body = $frame->body;
+             my $args = decode_json($body); # TODO Should this be from_json?
Check utf8 flag.
+
+             # FIXME This means we need to have create the DB entry before
+             # It could work in a first step, but then we will want to handle
job that will be created from the message received
+             $job = Koha::BackgroundJobs->find($args->{job_id});
+
+             process_job( $job, $args );
+         } catch {
+             Koha::Logger->get->warn(sprintf "Job and/or frame not processed -
%s", $_);
+         } finally {
+             $job->status('failed')->store if $job && @_;
+             $conn->ack( { frame => $frame } );
+         };
++>>>>>>> Bug 32393: Prevent invalid job to block the job queue

Here ack and process_job are reversing order again..

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list