Skip to content

Catch ETS exception when system is still starting #10375

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions deps/rabbitmq_stream/src/rabbit_stream.erl
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,19 @@ port() ->
end.

port_from_listener() ->
Listeners = rabbit_networking:node_listeners(node()),
Port =
try
Listeners = rabbit_networking:node_listeners(node()),
lists:foldl(fun (#listener{port = Port, protocol = stream}, _Acc) ->
Port;
(_, Acc) ->
Acc
end,
undefined, Listeners),
Port.
undefined, Listeners)
catch error:Reason ->
%% can happen if a remote node calls and the current has not fully started yet
rabbit_log:info("Error while retrieving stream plugin port: ~tp", [Reason]),
{error, Reason}
end.

tls_port() ->
case application:get_env(rabbitmq_stream, advertised_tls_port,
Expand All @@ -108,16 +112,20 @@ tls_port() ->
end.

tls_port_from_listener() ->
Listeners = rabbit_networking:node_listeners(node()),
Port =
try
Listeners = rabbit_networking:node_listeners(node()),
lists:foldl(fun (#listener{port = Port, protocol = 'stream/ssl'},
_Acc) ->
Port;
(_, Acc) ->
Acc
end,
undefined, Listeners),
Port.
undefined, Listeners)
catch error:Reason ->
%% can happen if a remote node calls and the current has not fully started yet
rabbit_log:info("Error while retrieving stream plugin port: ~tp", [Reason]),
{error, Reason}
end.

stop(_State) ->
ok.
Expand Down