connector

This commit is contained in:
4tochka 2019-06-02 13:59:06 +04:00
parent acd1fb0277
commit e1d0deecd8
2 changed files with 9 additions and 3 deletions

View File

@ -432,9 +432,6 @@ class Connector:
loading = "Loading ... " if self.cache_loading else "" loading = "Loading ... " if self.cache_loading else ""
if self.deep_synchronization: if self.deep_synchronization:
self.log.debug("-Blocks--------------------------------------------------------------------") self.log.debug("-Blocks--------------------------------------------------------------------")
self.log.debug("Blocks downloaded %s s; decoded %s s" % (int(self.blocks_download_time),
int(self.blocks_decode_time)))
self.log.debug("Blocks not cached %s; " self.log.debug("Blocks not cached %s; "
"blocks cached %s; " "blocks cached %s; "
@ -462,6 +459,9 @@ class Connector:
self.utxo.saved_utxo, self.utxo.saved_utxo,
self.utxo.deleted_utxo, self.utxo.deleted_utxo,
self.utxo.loaded_utxo)) self.utxo.loaded_utxo))
self.log.debug("Read from db last batch %s s; "
"total %s s; " % (round(self.utxo.read_from_db_time, 4),
int(self.utxo.read_from_db_time_total))
self.log.debug("-Coins--------------------------------------------------------------------") self.log.debug("-Coins--------------------------------------------------------------------")
self.log.debug("Coins %s; destroyed %s; " self.log.debug("Coins %s; destroyed %s; "
"unspent %s; op_return %s;" % (self.coins, "unspent %s; op_return %s;" % (self.coins,
@ -578,6 +578,7 @@ class Connector:
tx["vIn"][i]["coin"] = inp["_a_"] tx["vIn"][i]["coin"] = inp["_a_"]
c += 1 c += 1
self.preload_cached_annihilated += 1 self.preload_cached_annihilated += 1
self.preload_cached_total += 1
except: except:
try: try:
tx["vIn"][i]["coin"] = inp["_c_"] tx["vIn"][i]["coin"] = inp["_c_"]

View File

@ -43,6 +43,8 @@ class UTXO():
self.deleted_utxo = 0 self.deleted_utxo = 0
self.deleted_last_block = 0 self.deleted_last_block = 0
self.deleted_utxo = 0 self.deleted_utxo = 0
self.read_from_db_time = 0
self.read_from_db_time_total = 0
self.loaded_utxo = 0 self.loaded_utxo = 0
self.destroyed_utxo = 0 self.destroyed_utxo = 0
self.destroyed_utxo_block = 0 self.destroyed_utxo_block = 0
@ -193,6 +195,7 @@ class UTXO():
try: try:
self.load_utxo_future = asyncio.Future() self.load_utxo_future = asyncio.Future()
l = list(self.missed) l = list(self.missed)
t = time.time()
if self.db_type == "postgresql": if self.db_type == "postgresql":
async with self.db.acquire() as conn: async with self.db.acquire() as conn:
rows = await conn.fetch("SELECT outpoint, " rows = await conn.fetch("SELECT outpoint, "
@ -235,6 +238,8 @@ class UTXO():
for i in l: for i in l:
try: self.missed.remove(i) try: self.missed.remove(i)
except: pass except: pass
self.read_from_db_time += time.time() - t
self.read_from_db_time_total += time.time() - t
finally: finally: