forked from LBRYCommunity/lbry-sdk
convert full scan iterators to range scans
This commit is contained in:
parent
0d9d576436
commit
32b26c9fa5
1 changed files with 5 additions and 4 deletions
|
@ -656,7 +656,6 @@ class HubDB:
|
||||||
claim_txo.tx_num, claim_txo.position, claim_hash, claim_txo.name, claim_txo.root_tx_num,
|
claim_txo.tx_num, claim_txo.position, claim_hash, claim_txo.name, claim_txo.root_tx_num,
|
||||||
claim_txo.root_position, activation, claim_txo.channel_signature_is_valid
|
claim_txo.root_position, activation, claim_txo.channel_signature_is_valid
|
||||||
)
|
)
|
||||||
|
|
||||||
if claim:
|
if claim:
|
||||||
batch.append(claim)
|
batch.append(claim)
|
||||||
if len(batch) == batch_size:
|
if len(batch) == batch_size:
|
||||||
|
@ -742,7 +741,9 @@ class HubDB:
|
||||||
|
|
||||||
def get_counts():
|
def get_counts():
|
||||||
return [
|
return [
|
||||||
v.tx_count for v in self.prefix_db.tx_count.iterate(include_key=False, fill_cache=False)
|
v.tx_count for v in self.prefix_db.tx_count.iterate(
|
||||||
|
start=(0,), stop=(self.db_height + 1,), include_key=False, fill_cache=False
|
||||||
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
tx_counts = await asyncio.get_event_loop().run_in_executor(self._executor, get_counts)
|
tx_counts = await asyncio.get_event_loop().run_in_executor(self._executor, get_counts)
|
||||||
|
@ -777,7 +778,7 @@ class HubDB:
|
||||||
def get_headers():
|
def get_headers():
|
||||||
return [
|
return [
|
||||||
header for header in self.prefix_db.header.iterate(
|
header for header in self.prefix_db.header.iterate(
|
||||||
include_key=False, fill_cache=False, deserialize_value=False
|
start=(0, ), stop=(self.db_height + 1, ), include_key=False, fill_cache=False, deserialize_value=False
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -787,7 +788,7 @@ class HubDB:
|
||||||
|
|
||||||
async def _read_tx_hashes(self):
|
async def _read_tx_hashes(self):
|
||||||
def _read_tx_hashes():
|
def _read_tx_hashes():
|
||||||
return list(self.prefix_db.tx_hash.iterate(include_key=False, fill_cache=False, deserialize_value=False))
|
return list(self.prefix_db.tx_hash.iterate(start=(0,), stop=(self.db_tx_count + 1), include_key=False, fill_cache=False, deserialize_value=False))
|
||||||
|
|
||||||
self.logger.info("loading tx hashes")
|
self.logger.info("loading tx hashes")
|
||||||
self.total_transactions.clear()
|
self.total_transactions.clear()
|
||||||
|
|
Loading…
Reference in a new issue