Skip to content

Commit

Permalink
fix: batching calls that shouldnt (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler authored Nov 8, 2024
1 parent 7923f6d commit 5b1b2d4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions dank_mids/_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,14 @@ def __init__(self, controller: "DankMiddlewareController", method: RPCEndpoint,
self._started = False
self._retry = retry
super().__init__()

with self.controller.pools_closed_lock:
if isinstance(self, eth_call) and self.multicall_compatible:
self.controller.pending_eth_calls[self.block].append(self)
else:
self.controller.pending_rpc_calls.append(self)
if self.should_batch:
with self.controller.pools_closed_lock:
if isinstance(self, eth_call) and self.multicall_compatible:
self.controller.pending_eth_calls[self.block].append(self)
elif self.method.startswith(("trace", "debug")):
raise NotImplementedError("we should not get here", self)
else:
self.controller.pending_rpc_calls.append(self)
demo_logger.info(f'added to queue (cid: {self.uid})') # type: ignore
if logger.isEnabledFor(logging.DEBUG):
self._daemon = asyncio.create_task(self._debug_daemon())
Expand Down

0 comments on commit 5b1b2d4

Please sign in to comment.