diff options
| author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2019-04-15 10:32:22 +0200 |
|---|---|---|
| committer | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2019-04-15 10:32:22 +0200 |
| commit | 442768afdcbdcf1c08d9ca90f1704cfceae4734f (patch) | |
| tree | 4473414a92c17396bc9c48af5d97b8942816a0ec | |
| parent | a0ef063126560ca4e99b6c2816c8de4e25d7a804 (diff) | |
| download | rabbitmq-server-git-442768afdcbdcf1c08d9ca90f1704cfceae4734f.tar.gz | |
rabbit: Compute `totals` in status() only if RabbitMQ is running
The `app_management` testcase checks that status() works even with
RabbitMQ stopped (but the node is running). To restore that fact,
`totals` are only computed if RabbitMQ is running. Otherwise the list of
`totals` is empty.
The problem reported by the testcase without this patch was that the
`rabbit_vhost` Mnesia table was unavailable:
{exit,{aborted,{no_exists,rabbit_vhost}}}
| -rw-r--r-- | src/rabbit.erl | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl index 0f127365de..09b0494ce1 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -856,11 +856,16 @@ status() -> S6 = [{config_files, config_files()}, {log_files, log_locations()}, {data_directory, rabbit_mnesia:dir()}], - S7 = [{totals, [ - {virtual_host_count, rabbit_vhost:count()}, - {connection_count, length(rabbit_networking:connections_local())}, - {queue_count, total_queue_count()} - ]}], + Totals = case rabbit:is_running() of + true -> + [{virtual_host_count, rabbit_vhost:count()}, + {connection_count, + length(rabbit_networking:connections_local())}, + {queue_count, total_queue_count()}]; + false -> + [] + end, + S7 = [{totals, Totals}], S1 ++ S2 ++ S3 ++ S4 ++ S5 ++ S6 ++ S7. alarms() -> |
