File tree Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -585,16 +585,30 @@ remove_down_member(NodeToRemove) ->
585585% % @private
586586
587587reset () ->
588- % % Rabbit should be stopped, but Khepri needs to be running. Restart it.
589- ok = setup (),
590- ok = khepri_cluster :reset (? RA_CLUSTER_NAME ),
591- ok = khepri :stop (? RA_CLUSTER_NAME ).
588+ case rabbit :is_running () of
589+ false ->
590+ % % Rabbit should be stopped, but Khepri needs to be running.
591+ % % Restart it.
592+ ok = setup (),
593+ ok = khepri_cluster :reset (? RA_CLUSTER_NAME ),
594+ ok = khepri :stop (? RA_CLUSTER_NAME );
595+ true ->
596+ throw ({error , rabbitmq_unexpectedly_running })
597+ end .
592598
593599% % @private
594600
595601force_reset () ->
596- DataDir = maps :get (data_dir , ra_system :fetch (coordination )),
597- ok = rabbit_file :recursive_delete (filelib :wildcard (DataDir ++ " /*" )).
602+ case rabbit :is_running () of
603+ false ->
604+ ok = khepri :stop (? RA_CLUSTER_NAME ),
605+ DataDir = maps :get (data_dir , ra_system :fetch (coordination )),
606+ ok = ra_system :ensure_ra_system_stopped (coordination ),
607+ ok = rabbit_file :recursive_delete (
608+ filelib :wildcard (DataDir ++ " /*" ));
609+ true ->
610+ throw ({error , rabbitmq_unexpectedly_running })
611+ end .
598612
599613% % @private
600614
Original file line number Diff line number Diff line change 1616 all_ra_systems /0 ,
1717 are_running /0 ,
1818 ensure_ra_system_started /1 ,
19+ ensure_ra_system_stopped /1 ,
1920 ensure_started /0 ,
2021 ensure_stopped /0 ]).
2122
You can’t perform that action at this time.
0 commit comments