Browse Source

Reduce upper limit on blocks fetched at once

Testnet is lumpy and 2500 can blow up memory
master
Neil Booth 8 years ago
parent
commit
790755b630
  1. 5
      server/block_processor.py

5
server/block_processor.py

@ -87,10 +87,11 @@ class Prefetcher(LoggedClass):
with await self.semaphore:
while self.cache_size < self.min_cache_size:
# Try and catch up all blocks but limit to room in cache.
# Constrain fetch count to between 0 and 2500 regardless.
# Constrain fetch count to between 0 and 500 regardless;
# testnet can be lumpy.
cache_room = self.min_cache_size // self.ave_size
count = min(daemon_height - self.fetched_height, cache_room)
count = min(2500, max(count, 0))
count = min(500, max(count, 0))
if not count:
if not self.caught_up:
self.caught_up = True

Loading…
Cancel
Save