diff --git a/lbry/wallet/server/block_processor.py b/lbry/wallet/server/block_processor.py index 0e06aebd7..d0e33e812 100644 --- a/lbry/wallet/server/block_processor.py +++ b/lbry/wallet/server/block_processor.py @@ -1754,11 +1754,13 @@ class BlockProcessor: self._caught_up_event = caught_up_event try: - await self.db.open_dbs() + self.db.open_db() self.height = self.db.db_height self.tip = self.db.db_tip self.tx_count = self.db.db_tx_count self.status_server.set_height(self.db.fs_height, self.db.db_tip) + await self.db.initialize_caches() + await self.db.search_index.start() await asyncio.wait([ self.prefetcher.main_loop(self.height), self._process_prefetched_blocks() diff --git a/lbry/wallet/server/db/elasticsearch/sync.py b/lbry/wallet/server/db/elasticsearch/sync.py index 35941b61a..79331102d 100644 --- a/lbry/wallet/server/db/elasticsearch/sync.py +++ b/lbry/wallet/server/db/elasticsearch/sync.py @@ -15,14 +15,15 @@ async def get_recent_claims(env, index_name='claims', db=None): db = db or LevelDB(env) try: if need_open: - await db.open_dbs() - db_state = db.prefix_db.db_state.get() - if db_state.es_sync_height == db_state.height: + db.open_db() + if db.es_sync_height == db.db_height or db.db_height <= 0: return + if need_open: + await db.initialize_caches() cnt = 0 touched_claims = set() deleted_claims = set() - for height in range(db_state.es_sync_height, db_state.height + 1): + for height in range(db.es_sync_height, db.db_height + 1): touched_or_deleted = db.prefix_db.touched_or_deleted.get(height) touched_claims.update(touched_or_deleted.touched_claims) deleted_claims.update(touched_or_deleted.deleted_claims) @@ -65,7 +66,8 @@ async def get_all_claims(env, index_name='claims', db=None): need_open = db is None db = db or LevelDB(env) if need_open: - await db.open_dbs() + db.open_db() + await db.initialize_caches() logging.info("Fetching claims to send ES from leveldb") try: cnt = 0 diff --git a/lbry/wallet/server/leveldb.py b/lbry/wallet/server/leveldb.py index dddf3f1fb..426778d07 100644 --- a/lbry/wallet/server/leveldb.py +++ b/lbry/wallet/server/leveldb.py @@ -823,7 +823,7 @@ class LevelDB: return struct.unpack('