Skip to content

Commit b9b6b3d

Browse files
Ayanda-Dansd
authored andcommitted
avoid repeat vhost existance checks when adding vhosts
1 parent 9ff387e commit b9b6b3d

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

deps/rabbit/src/rabbit_vhost.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ put_vhost(Name, Description, Tags0, DefaultQueueType, Trace, Username) ->
336336
Metadata0#{default_queue_type =>
337337
DefaultQueueType}
338338
end,
339-
case add(Name, Metadata, Username) of
339+
case catch do_add(Name, Metadata, Username) of
340340
ok ->
341341
%% wait for up to 45 seconds for the vhost to initialise
342342
%% on all nodes

deps/rabbitmq_event_exchange/src/rabbit_exchange_type_event.erl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,7 @@ code_change(_OldVsn, State, _Extra) -> {ok, State}.
107107
%%----------------------------------------------------------------------------
108108

109109
ensure_vhost_exists(VHost) ->
110-
case rabbit_vhost:exists(VHost) of
111-
false -> rabbit_vhost:add(VHost, ?INTERNAL_USER);
112-
_ -> ok
113-
end.
110+
rabbit_vhost:add(VHost, ?INTERNAL_USER).
114111

115112
%% pattern matching is way more efficient that the string operations,
116113
%% let's use all the keys we're aware of to speed up the handler.

0 commit comments

Comments
 (0)