From bde3a9f13affbd3dba8dccf192f3be0231053960 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 --- 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 059d7069ba8..44f7990ed46 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.25.1