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

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

View file

@ -210,7 +210,6 @@ class Daemon(AuthJSONRPCServer):
self.query_handlers = {} self.query_handlers = {}
self.waiting_on = {} self.waiting_on = {}
self.streams = {} self.streams = {}
self.name_cache = {}
self.exchange_rate_manager = ExchangeRateManager() self.exchange_rate_manager = ExchangeRateManager()
calls = { calls = {
Checker.INTERNET_CONNECTION: LoopingCall(CheckInternetConnection(self)), Checker.INTERNET_CONNECTION: LoopingCall(CheckInternetConnection(self)),
@ -247,7 +246,6 @@ class Daemon(AuthJSONRPCServer):
yield self._initial_setup() yield self._initial_setup()
yield threads.deferToThread(self._setup_data_directory) yield threads.deferToThread(self._setup_data_directory)
yield self._check_db_migration() yield self._check_db_migration()
yield self._load_caches()
yield self._get_session() yield self._get_session()
yield self._get_analytics() yield self._get_analytics()
yield add_lbry_file_to_sd_identifier(self.sd_identifier) yield add_lbry_file_to_sd_identifier(self.sd_identifier)
@ -271,18 +269,6 @@ class Daemon(AuthJSONRPCServer):
d = _log_platform() d = _log_platform()
return d 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): def _check_network_connection(self):
self.connected_to_internet = utils.check_connection() 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) dt = utils.utcnow() - utils.datetime_obj(year=2012, month=12, day=21)
return int(dt.total_seconds()) 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 @defer.inlineCallbacks
def _resolve_name(self, name, force_refresh=False): def _resolve_name(self, name, force_refresh=False):
"""Resolves a name. Checks the cache first before going out to the blockchain. """Resolves a name. Checks the cache first before going out to the blockchain.