Skip to content

Commit 8ed9d64

Browse files
committed
update
1 parent 9c562e6 commit 8ed9d64

File tree

6 files changed

+1568
-1563
lines changed

6 files changed

+1568
-1563
lines changed

build_cats.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def build_cache(self):
3535
url = entry.get("d")
3636

3737
before_lookup = datetime.now()
38-
description, cache_hit = self.desc_cache.cache_lookup( url) #, self.soup_builder )
38+
description, cache_hit = self.desc_cache.cache_lookup_load_if_missing(url) #, self.soup_builder )
3939
after_lookup = datetime.now()
4040

4141
if description is None or description.description == "":

dcache.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@ def __init__(self, enable_http_client, enable_selenium):
1515
def show(self, prefix="", suffix=""):
1616
print(f"{prefix} Total: new lookups succeeded: {self.cache_load_ok} new lookups failed: {self.cache_load_failed} number of {suffix}")
1717

18-
def cache_lookup(self, url):
19-
print(f"cache_lookup {url}")
18+
def cache_lookup_load_if_missing(self, url):
19+
print(f"cache_lookup_load_if_missing {url}")
2020

2121
rval = self.cache_get(url)
22-
if rval is not None and rval != "":
23-
print(f"cache entry exists: {rval}")
24-
return rval, True
22+
if rval is not None:
23+
txt = rval.description
24+
if txt is not None and txt != "":
25+
print(f"cache entry with description already exists: {rval}")
26+
return rval, True
27+
2528

2629
if self.enable_http_client:
2730
if url in DescriptionCache.ignore_set:

dcachebase.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ def set_changed(self):
5959
def cache_get(self, url):
6060
descr = self.map_url_to_descr.get(url, None)
6161
if descr is not None:
62-
txt = descr.get("description")
63-
if txt is not None and txt != "":
64-
return CacheItem.from_dict(descr)
62+
return CacheItem.from_dict(descr)
6563
return None
6664

6765
def cache_set(self, url, obj):

0 commit comments

Comments
 (0)