Refactor import scripts

This commit is contained in:
Louis Holbrook
2021-02-21 15:41:37 +00:00
parent 1274958493
commit 96b4ad4a72
91 changed files with 5872 additions and 1261 deletions

View File

@@ -21,7 +21,7 @@ class HistorySyncer(MinedSyncer):
:param mx: Maximum number of blocks to return in one call
:type mx: int
"""
def __init__(self, bc_cache, mx=20):
def __init__(self, bc_cache, mx=500):
super(HistorySyncer, self).__init__(bc_cache)
self.max = mx

View File

@@ -23,6 +23,8 @@ class MinedSyncer(Syncer):
:type bc_cache: Object implementing methods from cic_eth.sync.SyncerBackend
"""
yield_delay = 0.005
def __init__(self, bc_cache):
super(MinedSyncer, self).__init__(bc_cache)
self.block_offset = 0
@@ -100,5 +102,8 @@ class MinedSyncer(Syncer):
block_number = self.process(c.w3, block.hex())
logg.info('processed block {} {}'.format(block_number, block.hex()))
self.bc_cache.disconnect()
time.sleep(interval)
if len(e) > 0:
time.sleep(self.yield_delay)
else:
time.sleep(interval)
logg.info("Syncer no longer set to run, gracefully exiting")