Bug 38988: Make the polling use case be normal in about page

This patch makes choosing `polling` for the `JobsNotificationMethod`
system preference not be considered problematic or different than
`STOMP`.

To test:
1. In `KTD` make sure you have `STOMP` selected
2. Make sure rabbitmq is running:
   $ ktd --shell
  k$ sudo -s
   $ service rabbitmq-server start
3. Go to the about page, 'Server information'
=> SUCCESS: 'Using RabbitMQ' displayed
4. Stop rabbit
   $ service rabbitmq-server stop
5. Repeat 3
=> SUCCESS: Using Rabbit but fallback to polling
6. Go to the 'System information' tab
=> SUCCESS: Error message about the broker not functional
7. Choose 'polling'
8. Repeat 3
=> FAIL: It says 'Using SQL polling' but in bold face <.<
9. Repeat 6
=> FAIL: There's an error about the broker, which we explicitly asked
not to use <.<
10. Apply this patch
11. Repeat 3
=> SUCCESS: Nothing weird, 'Using SQL polling' displayed.
12. Repeat 6
=> SUCCESS: No weird error about the broker.
13. Switch to 'STOMP'
=> SUCCESS: Behavior is the same with/without rabbit running
14. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Tomas Cohen Arazi 2025-01-28 14:48:54 -03:00 committed by Katrin Fischer
parent bf14a89382
commit 9cbc606697
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
2 changed files with 14 additions and 14 deletions

View File

@ -179,7 +179,7 @@ if ( $tab eq 'about' ) {
$where_is_memcached_config = 'config_only';
}
message_broker_check($template);
job_notification_method_check($template);
elasticsearch_check($template);
$template->param(
@ -599,7 +599,7 @@ if ( $tab eq 'sysinfo' ) {
$template->param( warnFastCataloging => $no_FA_framework );
}
message_broker_check($template);
job_notification_method_check($template);
#BZ 28267: Warn administrators if there are database rows with a format other than 'DYNAMIC'
{
@ -907,17 +907,15 @@ sub elasticsearch_check {
}
}
sub message_broker_check {
my $template = shift;
{
sub job_notification_method_check {
my ($template) = @_;
if ( C4::Context->preference('JobsNotificationMethod') eq 'STOMP' ) {
# BackgroundJob - test connection to message broker
my $conn = Koha::BackgroundJob->connect;
if ( !$conn ) {
if ( C4::Context->preference('JobsNotificationMethod') eq 'STOMP' ) {
$template->param( warnConnectBroker => 'Error connecting' );
} else {
$template->param( warnConnectBroker => C4::Context->preference('JobsNotificationMethod') );
}
$template->param( warnConnectBroker => 1 );
}
}
}

View File

@ -223,12 +223,14 @@
</tr>
<tr>
<th scope="row">Message broker: </th>
[% IF warnConnectBroker == 'Error connecting' %]
[% IF warnConnectBroker %]
<td class="text-bg-warning"><strong>Using SQL polling (Fallback, Error connecting to RabbitMQ)</strong></td>
[% ELSIF warnConnectBroker %]
<td class="text-bg-warning"><strong>Using SQL polling</strong></td>
[% ELSE %]
<td class="text-bg-info">Using RabbitMQ</td>
[% IF Koha.Preference('JobsNotificationMethod') == 'polling' %]
<td class="text-bg-info">Using SQL polling</td>
[% ELSE %]
<td class="text-bg-info">Using RabbitMQ</td>
[% END %]
[% END %]
</tr>
<tr>