Merge pull request #550 from lbryio/handle-bad-claim-cache-file

Handle failure to read claim cache file
This commit is contained in:
Alex Grin 2017-03-21 16:44:37 -04:00 committed by GitHub
commit 05f7f5c73c
2 changed files with 8 additions and 4 deletions

View file

@ -24,7 +24,7 @@ at anytime.
* Fixed api help return * Fixed api help return
* Fixed API command descriptor_get * Fixed API command descriptor_get
* Fixed API command transaction_show * Fixed API command transaction_show
* * Handle failure to decode claim cache file
* *
## [0.9.1] - 2017-03-17 ## [0.9.1] - 2017-03-17

View file

@ -350,9 +350,13 @@ class Daemon(AuthJSONRPCServer):
name_cache_filename = os.path.join(self.db_dir, "stream_info_cache.json") name_cache_filename = os.path.join(self.db_dir, "stream_info_cache.json")
if os.path.isfile(name_cache_filename): if os.path.isfile(name_cache_filename):
with open(name_cache_filename, "r") as name_cache: with open(name_cache_filename, "r") as name_cache_file:
self.name_cache = json.loads(name_cache.read()) name_cache = name_cache_file.read()
try:
self.name_cache = json.loads(name_cache)
log.info("Loaded claim info cache") log.info("Loaded claim info cache")
except ValueError:
log.warning("Unable to load claim info cache")
def _check_network_connection(self): def _check_network_connection(self):
self.connected_to_internet = utils.check_connection() self.connected_to_internet = utils.check_connection()