From 54e87225eac2c70aa6487b6f614bddc3083a774b Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 24 Jan 2023 09:11:25 +0100 Subject: [PATCH] Bug 32393: Deal with the DB fallback part Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 85c330d8f2ca6246cf3619c8075907cce8387be0) Signed-off-by: Matt Blenkinsop --- misc/background_jobs_worker.pl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/misc/background_jobs_worker.pl b/misc/background_jobs_worker.pl index 059d7069ba..44f7990ed4 100755 --- a/misc/background_jobs_worker.pl +++ b/misc/background_jobs_worker.pl @@ -119,8 +119,17 @@ while (1) { } else { my $jobs = Koha::BackgroundJobs->search({ status => 'new', queue => \@queues }); while ( my $job = $jobs->next ) { - my $args = $job->json->decode($job->data); + my $args = try { + $job->json->decode($job->data); + } catch { + Koha::Logger->get->warn(sprintf "Cannot decode data for job id=%s", $job->id); + $job->status('failed')->store; + }; + + next unless $args; + process_job( $job, { job_id => $job->id, %$args } ); + } sleep 10; } -- 2.39.5