You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2018/11/22 17:48:46 UTC

[GitHub] janl commented on a change in pull request #1755: feat: do not record server admin requests as cache misses

janl commented on a change in pull request #1755: feat: do not record server admin requests as cache misses
URL: https://github.com/apache/couchdb/pull/1755#discussion_r235796195
 
 

 ##########
 File path: src/chttpd/src/chttpd_auth_cache.erl
 ##########
 @@ -84,11 +83,20 @@ get_from_cache(UserName) ->
             end
     catch
         error:badarg ->
-            couch_stats:increment_counter([couchdb, auth_cache_misses]),
-            couch_log:debug("cache miss for ~s", [UserName]),
+            maybe_increment_auth_cache_miss(UserName),
             load_user_from_db(UserName)
     end.
 
+maybe_increment_auth_cache_miss(UserName) ->
+    Admins = config:get("admins"),
+    case proplists:get_value(?b2l(UserName), Admins) of
 
 Review comment:
   @eiri good observation, however, `config:get(section)` returns a proplist like `[{Name, PassHash}],{Name2,Pass2Hash}]`, so it’d have to be at least `lists:keymember()`, but I’m not sure it is faster.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services