This commit is contained in:
Jack Robison 2021-06-16 16:47:41 -04:00
parent d0d6e3563b
commit 7c34e4bb96
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 3 additions and 16 deletions

View file

@ -442,7 +442,9 @@ class BlockProcessor:
start = time.perf_counter() start = time.perf_counter()
try: try:
for block in blocks: for block in blocks:
start = time.perf_counter()
await self.run_in_thread_with_lock(self.advance_block, block) await self.run_in_thread_with_lock(self.advance_block, block)
self.logger.info("advanced to %i in %ds", self.height, time.perf_counter() - start)
# TODO: we shouldnt wait on the search index updating before advancing to the next block # TODO: we shouldnt wait on the search index updating before advancing to the next block
# await self.db.search_index.claim_consumer(self.claim_producer()) # await self.db.search_index.claim_consumer(self.claim_producer())
self.db.search_index.clear_caches() self.db.search_index.clear_caches()

View file

@ -728,26 +728,11 @@ class LevelDB:
batch_put(DB_PREFIXES.UTXO_PREFIX.value + hashX + suffix, value[-8:]) batch_put(DB_PREFIXES.UTXO_PREFIX.value + hashX + suffix, value[-8:])
flush_data.adds.clear() flush_data.adds.clear()
# Flush state last as it reads the wall time.
start_time = time.time()
add_count = len(flush_data.adds)
spend_count = len(flush_data.deletes) // 2
if self.db.for_sync:
block_count = flush_data.height - self.db_height
tx_count = flush_data.tx_count - self.db_tx_count
elapsed = time.time() - start_time
self.logger.info(f'advanced to {flush_data.height:,d} with '
f'{tx_count:,d} txs, {add_count:,d} UTXO adds, '
f'{spend_count:,d} spends, {op_count:,d} claim ops in '
f'{elapsed:.1f}s, committing...')
self.utxo_flush_count = self.hist_flush_count self.utxo_flush_count = self.hist_flush_count
self.db_height = flush_data.height self.db_height = flush_data.height
self.db_tx_count = flush_data.tx_count self.db_tx_count = flush_data.tx_count
self.db_tip = flush_data.tip self.db_tip = flush_data.tip
# self.flush_state(batch)
#
now = time.time() now = time.time()
self.wall_time += now - self.last_flush self.wall_time += now - self.last_flush
self.last_flush = now self.last_flush = now