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_r346435943
 
 

 ##########
 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:
   Good point. It might look better if we return an already updated Db handle 
that has value already 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

Reply via email to