connector

This commit is contained in:
4tochka 2019-05-25 21:55:03 +04:00
parent 3c96d0d18e
commit 0a00eebdc7

View File

@ -24,6 +24,7 @@ class UTXO():
self.last_saved_block = 0 self.last_saved_block = 0
self.last_cached_block = 0 self.last_cached_block = 0
self.save_process = False self.save_process = False
self.write_to_db = False
self.load_utxo_future = asyncio.Future() self.load_utxo_future = asyncio.Future()
self.load_utxo_future.set_result(True) self.load_utxo_future.set_result(True)
self._requests = 0 self._requests = 0
@ -96,7 +97,9 @@ class UTXO():
async def save_checkpoint(self): async def save_checkpoint(self):
# save to db tail from cache # save to db tail from cache
if not self.checkpoint: return if not self.checkpoint: return
if self.write_to_db: return
try: try:
self.write_to_db = True
if not self.checkpoint: return if not self.checkpoint: return
@ -126,6 +129,7 @@ class UTXO():
finally: finally:
self.pending_saved = OrderedDict() self.pending_saved = OrderedDict()
self.save_process = False self.save_process = False
self.write_to_db = False
def get(self, key): def get(self, key):
self._requests += 1 self._requests += 1