Merge pull request #780 from vv181/remove-stream-info-cache

remove stream info cache
This commit is contained in:
Alex Grin 2017-07-18 08:32:17 -04:00 committed by GitHub
commit 5a230fdab4
2 changed files with 3 additions and 22 deletions

View file

@ -39,8 +39,9 @@ at anytime.
### Fixed
* Fixed timeout behaviour when calling API command get
* Fixed https://github.com/lbryio/lbry/issues/765
### Removed
* Removed stream_info_cache.json from daemon.py
## [0.14.0] - 2017-07-05

View file

@ -210,7 +210,6 @@ class Daemon(AuthJSONRPCServer):
self.query_handlers = {}
self.waiting_on = {}
self.streams = {}
self.name_cache = {}
self.exchange_rate_manager = ExchangeRateManager()
calls = {
Checker.INTERNET_CONNECTION: LoopingCall(CheckInternetConnection(self)),
@ -247,7 +246,6 @@ class Daemon(AuthJSONRPCServer):
yield self._initial_setup()
yield threads.deferToThread(self._setup_data_directory)
yield self._check_db_migration()
yield self._load_caches()
yield self._get_session()
yield self._get_analytics()
yield add_lbry_file_to_sd_identifier(self.sd_identifier)
@ -271,18 +269,6 @@ class Daemon(AuthJSONRPCServer):
d = _log_platform()
return d
def _load_caches(self):
name_cache_filename = os.path.join(self.db_dir, "stream_info_cache.json")
if os.path.isfile(name_cache_filename):
with open(name_cache_filename, "r") as name_cache_file:
name_cache = name_cache_file.read()
try:
self.name_cache = json.loads(name_cache)
log.info("Loaded claim info cache")
except ValueError:
log.warning("Unable to load claim info cache")
def _check_network_connection(self):
self.connected_to_internet = utils.check_connection()
@ -671,12 +657,6 @@ class Daemon(AuthJSONRPCServer):
dt = utils.utcnow() - utils.datetime_obj(year=2012, month=12, day=21)
return int(dt.total_seconds())
def _update_claim_cache(self):
f = open(os.path.join(self.db_dir, "stream_info_cache.json"), "w")
f.write(json.dumps(self.name_cache))
f.close()
return defer.succeed(True)
@defer.inlineCallbacks
def _resolve_name(self, name, force_refresh=False):
"""Resolves a name. Checks the cache first before going out to the blockchain.