You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2015/09/08 16:28:22 UTC

[2/2] chttpd commit: updated refs/heads/master to 6b18a8e

Don't insert nil into lru


Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/6b18a8e6
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/6b18a8e6
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/6b18a8e6

Branch: refs/heads/master
Commit: 6b18a8e6e5cab21a1fdc88b50f76f4d8c947672a
Parents: 9496363
Author: Robert Newson <rn...@apache.org>
Authored: Tue Sep 8 13:50:31 2015 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Tue Sep 8 13:50:31 2015 +0100

----------------------------------------------------------------------
 src/chttpd_auth_cache.erl | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/6b18a8e6/src/chttpd_auth_cache.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_auth_cache.erl b/src/chttpd_auth_cache.erl
index 843be34..6e39e5a 100644
--- a/src/chttpd_auth_cache.erl
+++ b/src/chttpd_auth_cache.erl
@@ -75,11 +75,15 @@ get_from_cache(UserName) ->
             couch_log:debug("cache hit for ~s", [UserName]),
             Props;
         _ ->
-            Props = load_user_from_db(UserName),
             couch_stats:increment_counter([couchdb, auth_cache_misses]),
             couch_log:debug("cache miss for ~s", [UserName]),
-            ets_lru:insert(?CACHE, UserName, Props),
-            Props
+            case load_user_from_db(UserName) of
+                nil ->
+                    nil;
+                Props ->
+                    ets_lru:insert(?CACHE, UserName, Props),
+                    Props
+            end
     catch
         error:badarg ->
             couch_stats:increment_counter([couchdb, auth_cache_misses]),