Oops, forgot to move test for lock failure above cache access

This commit is contained in:
Kovid Goyal 2021-05-06 15:18:11 +05:30
parent 5ff45a7ee7
commit dc88a74caa
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -2235,7 +2235,6 @@ class Cache(object):
# the cache and that recursive calls don't do the update. This # the cache and that recursive calls don't do the update. This
# method can recurse via self._search() # method can recurse via self._search()
with try_lock(self.vls_cache_lock) as got_lock: with try_lock(self.vls_cache_lock) as got_lock:
if self.vls_for_books_cache is None:
# Using a list is slightly faster than a set. # Using a list is slightly faster than a set.
c = defaultdict(list) c = defaultdict(list)
if not got_lock: if not got_lock:
@ -2247,6 +2246,7 @@ class Cache(object):
# VL then the eventual answer will be correct because get_metadata # VL then the eventual answer will be correct because get_metadata
# will clear the caches. # will clear the caches.
return c return c
if self.vls_for_books_cache is None:
self.vls_for_books_cache_is_loading = True self.vls_for_books_cache_is_loading = True
libraries = self._pref('virtual_libraries', {}) libraries = self._pref('virtual_libraries', {})
for lib, expr in libraries.items(): for lib, expr in libraries.items():