From 25fb7849a36ea4f7cee4b82370b1582f4e60386d Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Wed, 4 Dec 2024 14:57:57 -0400 Subject: [PATCH] fix: suppress StopIteration warning (#316) * fix: suppress StopIteration warning * chore: `black .` --------- Co-authored-by: github-actions[bot] --- dank_mids/_requests.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dank_mids/_requests.py b/dank_mids/_requests.py index c8fba5be..4200eb6f 100644 --- a/dank_mids/_requests.py +++ b/dank_mids/_requests.py @@ -721,11 +721,16 @@ async def get_response(self) -> None: # type: ignore [override] return await self._exec_single_call() # elif l < 50: # TODO play with later # return await JSONRPCBatch(self.controller, self.calls) + + # create a strong ref to all calls we will execute so they cant get gced mid execution and mess up response ordering + calls = tuple(self.calls) + if not calls: + # TODO: figure out how we get into this function without any calls + return + rid = self.controller.request_uid.next demo_logger.info(f"request {rid} for multicall {self.bid} starting") # type: ignore try: - # create a strong ref to all calls we will execute so they cant get gced mid execution and mess up response ordering - calls = tuple(self.calls) await self.spoof_response( await self.controller.make_request(self.method, self.params, request_id=self.uid), calls,