From 58b7f10bee8ea62161ab132eb9160096e423256d Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 22 Feb 2023 18:13:35 +0000 Subject: [PATCH] Bug 33044: Return job id if there is no connection to rabbit This patch simply ensures we returnt he job id even if we don't send the job to rabbit To test: 1 - In KTD: sudo service rabbitmq-server stop 2 - sudo koha-worker --stop kohadev; sudo koha-worker --queue long_tasks --stop kohadev 3 - In staff client enqueue a batch item modification - note the link to view the enqueued job has no id in the url and takes you to the main background jobs viewer 4 - Apply patch 5 - Restart all 6 - Enqueue a new batch item modification 7 - Confirm the link works and has the correct id Signed-off-by: David Nind --- Koha/BackgroundJob.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/BackgroundJob.pm b/Koha/BackgroundJob.pm index 0ba7ba46ed..f803c36b05 100644 --- a/Koha/BackgroundJob.pm +++ b/Koha/BackgroundJob.pm @@ -128,7 +128,7 @@ sub enqueue { } catch { warn "Cannot connect to broker " . $_; }; - return unless $conn; + return $self->id unless $conn; $json_args = $json->encode($job_args); try { -- 2.30.2