config.walker_name
This commit is contained in:
@@ -29,6 +29,7 @@ class Config:
|
|||||||
deployments: Optional[dict[str,str]] = field(default_factory=dict)
|
deployments: Optional[dict[str,str]] = field(default_factory=dict)
|
||||||
min_gas: str = '0'
|
min_gas: str = '0'
|
||||||
|
|
||||||
|
walker_name: str = 'default'
|
||||||
walker_flush_interval: float = 300
|
walker_flush_interval: float = 300
|
||||||
|
|
||||||
mirror_source_rpc_url: Optional[str] = None # source RPC for original pools
|
mirror_source_rpc_url: Optional[str] = None # source RPC for original pools
|
||||||
|
|||||||
@@ -28,11 +28,13 @@ class BlockWalker (BlockProgressor):
|
|||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
flush_callback:Callable[[],Maywaitable[None]] = None,
|
flush_callback:Callable[[],Maywaitable[None]] = None,
|
||||||
flush_delay: Union[None, int, timedelta] = None):
|
flush_delay: Union[None, int, timedelta] = None,
|
||||||
|
*, name: str=None):
|
||||||
"""
|
"""
|
||||||
:param flush_delay: either a number of blocks or a time interval. after the flush_delay
|
:param flush_delay: either a number of blocks or a time interval. after the flush_delay
|
||||||
"""
|
"""
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
self.name = name if name is not None else config.walker_name
|
||||||
self.queue: Queue = Queue()
|
self.queue: Queue = Queue()
|
||||||
self.running = False
|
self.running = False
|
||||||
self.flush_callback = flush_callback
|
self.flush_callback = flush_callback
|
||||||
@@ -49,7 +51,7 @@ class BlockWalker (BlockProgressor):
|
|||||||
batch_size = config.batch_size if config.batch_size is not None else chain.batch_size
|
batch_size = config.batch_size if config.batch_size is not None else chain.batch_size
|
||||||
current_blockstate.set(FinalizedBlockState())
|
current_blockstate.set(FinalizedBlockState())
|
||||||
|
|
||||||
kv_key = f'walker_height|{chain_id}'
|
kv_key = f'walker_height|{chain_id}|{self.name}'
|
||||||
with db.session:
|
with db.session:
|
||||||
processed_height = db.kv.get(kv_key)
|
processed_height = db.kv.get(kv_key)
|
||||||
if processed_height is None:
|
if processed_height is None:
|
||||||
|
|||||||
Reference in New Issue
Block a user