Skip to content

Commit 2a86dde

Browse files
committed
rabbit_db_vhost: Add no_return() to update/2 spec
This function throws if the database fails to apply the transaction. This function is only called by the `rabbit_vhost_limit` runtime parameter module in its `notify/5` and `notify_clear/4` callbacks. These callers have no way of handling this error but it should be very difficult for them to face this crash: setting the runtime parameter would need to succeed first which needs Khepri to be in majority. Khepri would need to enter a minority between inserting/updating/deleting the runtime parameter and updating the vhost. It's possible but unlikely. In the future we could consider refactoring vhost limits to update the vhost as the runtime parameter is changed, transactionally. I figure that to be a very large change though so we leave this to the future.
1 parent 4fd77d5 commit 2a86dde

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

deps/rabbit/src/rabbit_db_vhost.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ list_in_khepri() ->
349349
-spec update(VHostName, UpdateFun) -> VHost when
350350
VHostName :: vhost:name(),
351351
UpdateFun :: fun((VHost) -> VHost),
352-
VHost :: vhost:vhost().
352+
VHost :: vhost:vhost() | no_return().
353353
%% @doc Updates an existing virtual host record using the result of
354354
%% `UpdateFun'.
355355
%%

0 commit comments

Comments
 (0)