Browse Source

Yield more during mempool load

master
Neil Booth 8 years ago
parent
commit
95cc979465
  1. 4
      server/block_processor.py

4
server/block_processor.py

@ -215,7 +215,7 @@ class MemPool(LoggedClass):
for n, (hex_hash, tx) in enumerate(new_txs.items()): for n, (hex_hash, tx) in enumerate(new_txs.items()):
# Yield to process e.g. signals # Yield to process e.g. signals
if n % 500 == 0: if n % 100 == 0:
await asyncio.sleep(0) await asyncio.sleep(0)
txout_pairs = [txout_pair(txout) for txout in tx.outputs] txout_pairs = [txout_pair(txout) for txout in tx.outputs]
self.txs[hex_hash] = (None, txout_pairs, None) self.txs[hex_hash] = (None, txout_pairs, None)
@ -236,7 +236,7 @@ class MemPool(LoggedClass):
# Now add the inputs # Now add the inputs
for n, (hex_hash, tx) in enumerate(new_txs.items()): for n, (hex_hash, tx) in enumerate(new_txs.items()):
# Yield to process e.g. signals # Yield to process e.g. signals
if n % 50 == 0: if n % 10 == 0:
await asyncio.sleep(0) await asyncio.sleep(0)
if initial and time.time() > next_log: if initial and time.time() > next_log:

Loading…
Cancel
Save