Only attempt to flush if cancelled
This commit is contained in:
parent
1405057096
commit
06b6d695c2
@ -382,8 +382,9 @@ class BlockProcessor(server.db.DB):
|
|||||||
while True:
|
while True:
|
||||||
await self._wait_for_update()
|
await self._wait_for_update()
|
||||||
await asyncio.sleep(0) # Yield
|
await asyncio.sleep(0) # Yield
|
||||||
finally:
|
except asyncio.CancelledError:
|
||||||
self.flush(True)
|
self.flush(True)
|
||||||
|
raise
|
||||||
|
|
||||||
async def _wait_for_update(self):
|
async def _wait_for_update(self):
|
||||||
'''Wait for the prefetcher to deliver blocks or a mempool update.
|
'''Wait for the prefetcher to deliver blocks or a mempool update.
|
||||||
|
|||||||
@ -119,7 +119,6 @@ class DB(LoggedClass):
|
|||||||
|
|
||||||
if tx_height > self.db_height:
|
if tx_height > self.db_height:
|
||||||
return None, tx_height
|
return None, tx_height
|
||||||
raise self.DBError('tx_num {:,d} is not on disk')
|
|
||||||
|
|
||||||
file_pos = tx_num * 32
|
file_pos = tx_num * 32
|
||||||
file_num, offset = divmod(file_pos, self.tx_hash_file_size)
|
file_num, offset = divmod(file_pos, self.tx_hash_file_size)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user