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 15:48:02 UTC
[GitHub] eiri commented on a change in pull request #1755: feat: do not
record server admin requests as cache misses
eiri 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_r235768721
##########
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:
If all we want is to check if user is in admin list `lists:member/2` works better here. It's faster too.
----------------------------------------------------------------
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