diff --git a/lbry/wallet/server/session.py b/lbry/wallet/server/session.py index 31acb6c21..4ee328621 100644 --- a/lbry/wallet/server/session.py +++ b/lbry/wallet/server/session.py @@ -987,6 +987,11 @@ class LBRYElectrumX(SessionBase): except ConnectionTimeout: self.session_mgr.interrupt_count_metric.inc() raise RPCError(JSONRPC.QUERY_TIMEOUT, 'query timed out') + except TooManyClaimSearchParametersError as err: + await asyncio.sleep(2) + self.logger.warning("Got an invalid query from %s, for %s with more than %d elements.", + self.peer_address()[0], err.key, err.limit) + return RPCError(1, str(err)) finally: self.session_mgr.pending_query_metric.dec() self.session_mgr.executor_time_metric.observe(time.perf_counter() - start) diff --git a/tests/integration/blockchain/test_wallet_server_sessions.py b/tests/integration/blockchain/test_wallet_server_sessions.py index efee3bdf2..5473f5202 100644 --- a/tests/integration/blockchain/test_wallet_server_sessions.py +++ b/tests/integration/blockchain/test_wallet_server_sessions.py @@ -196,13 +196,13 @@ class TestHubDiscovery(CommandTestCase): class TestStressFlush(CommandTestCase): -# async def test_flush_over_66_thousand(self): -# history = self.conductor.spv_node.server.db.history -# history.flush_count = 66_000 -# history.flush() -# self.assertEqual(history.flush_count, 66_001) -# await self.generate(1) -# self.assertEqual(history.flush_count, 66_002) + # async def test_flush_over_66_thousand(self): + # history = self.conductor.spv_node.server.db.history + # history.flush_count = 66_000 + # history.flush() + # self.assertEqual(history.flush_count, 66_001) + # await self.generate(1) + # self.assertEqual(history.flush_count, 66_002) async def test_thousands_claim_ids_on_search(self): await self.stream_create()