nickva commented on a change in pull request #2300: Check security properties
in the main transaction
URL: https://github.com/apache/couchdb/pull/2300#discussion_r346466138
##########
File path: src/fabric/src/fabric2_db.erl
##########
@@ -440,26 +455,32 @@ is_users_db(DbName) when is_binary(DbName) ->
IsAuthCache orelse IsCfgUsersDb orelse IsGlobalUsersDb.
-set_revs_limit(#{} = Db, RevsLimit) ->
- check_is_admin(Db),
+set_revs_limit(#{} = Db0, RevsLimit) ->
+ Db1 = require_admin_check(Db0),
RevsLimBin = ?uint2bin(max(1, RevsLimit)),
- Resp = fabric2_fdb:transactional(Db, fun(TxDb) ->
+ Resp = fabric2_fdb:transactional(Db1, fun(TxDb) ->
fabric2_fdb:set_config(TxDb, <<"revs_limit">>, RevsLimBin)
end),
- if Resp /= ok -> Resp; true ->
- fabric2_server:store(Db#{revs_limit := RevsLimit})
+ case Resp of
+ {ok, #{} = Db2} ->
+ fabric2_server:store(Db2#{revs_limit := RevsLimit});
Review comment:
Updated with a separate commit which make set_config take already un-encoded
values and returns a handle with an updated db version and the config value set.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services