From 775943602a5b7a9d8adf27c8d25b4086298fd846 Mon Sep 17 00:00:00 2001 From: Didi Bar-Zev Date: Wed, 25 Jul 2018 20:18:25 +0300 Subject: [PATCH] PYTHON-1617 Fix database name check in index cache (#363) (cherry picked from commit ff958b7d674d8bffb053e725203e8cf202c5c432) --- pymongo/mongo_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymongo/mongo_client.py b/pymongo/mongo_client.py index cbafe39a95..d26a398f95 100644 --- a/pymongo/mongo_client.py +++ b/pymongo/mongo_client.py @@ -636,7 +636,7 @@ def _cache_index(self, dbname, collection, index, cache_for): expire = datetime.timedelta(seconds=cache_for) + now with self.__index_cache_lock: - if database not in self.__index_cache: + if dbname not in self.__index_cache: self.__index_cache[dbname] = {} self.__index_cache[dbname][collection] = {} self.__index_cache[dbname][collection][index] = expire