parent
bf279ceaea
commit
c3039db50c
@ -99,11 +99,11 @@ class Prefetcher(object):
|
|||||||
async with self.semaphore:
|
async with self.semaphore:
|
||||||
while self.cache_size < self.min_cache_size:
|
while self.cache_size < self.min_cache_size:
|
||||||
# Try and catch up all blocks but limit to room in cache.
|
# Try and catch up all blocks but limit to room in cache.
|
||||||
# Constrain fetch count to between 0 and 500 regardless;
|
# Constrain fetch count to between 0 and 100 regardless;
|
||||||
# testnet can be lumpy.
|
# some chains can be lumpy.
|
||||||
cache_room = max(self.min_cache_size // self.ave_size, 1)
|
cache_room = max(self.min_cache_size // self.ave_size, 1)
|
||||||
count = min(daemon_height - self.fetched_height, cache_room)
|
count = min(daemon_height - self.fetched_height, cache_room)
|
||||||
count = min(500, count)
|
count = min(100, max(count, 0))
|
||||||
if not count:
|
if not count:
|
||||||
self.caught_up = True
|
self.caught_up = True
|
||||||
return False
|
return False
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user