File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
rabbitmq_cli/lib/rabbitmq/cli Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -263,7 +263,7 @@ setup(_) ->
263
263
case khepri :start (? RA_SYSTEM , RaServerConfig ) of
264
264
{ok , ? STORE_ID } ->
265
265
wait_for_leader (),
266
- register_projections (),
266
+ wait_for_register_projections (),
267
267
? LOG_DEBUG (
268
268
" Khepri-based " ? RA_FRIENDLY_NAME " ready" ,
269
269
#{domain => ? RMQLOG_DOMAIN_GLOBAL }),
@@ -306,6 +306,21 @@ wait_for_leader(Timeout, Retries) ->
306
306
throw (Reason )
307
307
end .
308
308
309
+ wait_for_register_projections () ->
310
+ wait_for_register_projections (retry_timeout (), retry_limit ()).
311
+
312
+ wait_for_register_projections (_Timeout , 0 ) ->
313
+ exit (timeout_waiting_for_khepri_projections );
314
+ wait_for_register_projections (Timeout , Retries ) ->
315
+ rabbit_log :info (" Waiting for Khepri projections for ~tp ms, ~tp retries left" ,
316
+ [Timeout , Retries - 1 ]),
317
+ try
318
+ register_projections ()
319
+ catch
320
+ throw : timeout ->
321
+ wait_for_register_projections (Timeout , Retries - 1 )
322
+ end .
323
+
309
324
% % @private
310
325
311
326
can_join_cluster (DiscoveryNode ) when is_atom (DiscoveryNode ) ->
Original file line number Diff line number Diff line change @@ -82,6 +82,10 @@ defmodule RabbitMQ.CLI.DefaultOutput do
82
82
{ :error , RabbitMQ.CLI.Core.ExitCodes . exit_tempfail ( ) , khepri_timeout_error ( node_name ) }
83
83
end
84
84
85
+ defp format_khepri_output ( { :error , :timeout_waiting_for_khepri_projections } , % { node: node_name } ) do
86
+ { :error , RabbitMQ.CLI.Core.ExitCodes . exit_tempfail ( ) , khepri_timeout_error ( node_name ) }
87
+ end
88
+
85
89
defp format_khepri_output ( result , _opts ) do
86
90
result
87
91
end
You can’t perform that action at this time.
0 commit comments