Bug 30172: Enqueue the job even if rabbitmq is not reachable

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit ce24a745c3)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 25c3a72725)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
This commit is contained in:
Jonathan Druart 2022-03-24 16:24:06 +01:00 committed by Victor Grousset/tuxayo
parent 657c8008fb
commit 061b8d88ec
1 changed files with 10 additions and 2 deletions

View File

@ -101,6 +101,7 @@ sub enqueue {
my $borrowernumber = C4::Context->userenv->{number}; # FIXME Handle non GUI calls
my $json_args = encode_json $job_args;
$self->set(
{
status => 'new',
@ -113,10 +114,17 @@ sub enqueue {
)->store;
$job_args->{job_id} = $self->id;
$json_args = encode_json $job_args;
my $conn;
try {
$conn = $self->connect;
} catch {
warn "Cannot connect to broker " . $_;
};
return unless $conn;
$json_args = encode_json $job_args;
try {
my $conn = $self->connect;
# This namespace is wrong, it must be a vhost instead.
# But to do so it needs to be created on the server => much more work when a new Koha instance is created.
# Also, here we just want the Koha instance's name, but it's not in the config...