From 7b7f5dae4a38b1cd8236eafcce9edff7bccf50fa Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 18 Mar 2024 19:49:26 -0400 Subject: [PATCH] config.walker_name --- src/dexorder/configuration/schema.py | 1 + src/dexorder/walker.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dexorder/configuration/schema.py b/src/dexorder/configuration/schema.py index a59bfc5..98f3af5 100644 --- a/src/dexorder/configuration/schema.py +++ b/src/dexorder/configuration/schema.py @@ -29,6 +29,7 @@ class Config: deployments: Optional[dict[str,str]] = field(default_factory=dict) min_gas: str = '0' + walker_name: str = 'default' walker_flush_interval: float = 300 mirror_source_rpc_url: Optional[str] = None # source RPC for original pools diff --git a/src/dexorder/walker.py b/src/dexorder/walker.py index dbcd918..ee5b9fb 100644 --- a/src/dexorder/walker.py +++ b/src/dexorder/walker.py @@ -28,11 +28,13 @@ class BlockWalker (BlockProgressor): def __init__(self, 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 """ super().__init__() + self.name = name if name is not None else config.walker_name self.queue: Queue = Queue() self.running = False 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 current_blockstate.set(FinalizedBlockState()) - kv_key = f'walker_height|{chain_id}' + kv_key = f'walker_height|{chain_id}|{self.name}' with db.session: processed_height = db.kv.get(kv_key) if processed_height is None: