fix integration test
This commit is contained in:
parent
34500e07c6
commit
df41a82b23
2 changed files with 6 additions and 3 deletions
|
@ -15,6 +15,7 @@ class TestSessionBloat(IntegrationTestCase):
|
|||
|
||||
async def test_session_bloat_from_socket_timeout(self):
|
||||
await self.conductor.stop_spv()
|
||||
await self.ledger.stop()
|
||||
self.conductor.spv_node.session_timeout = 1
|
||||
await self.conductor.start_spv()
|
||||
session = ClientSession(network=None, server=self.ledger.network.client.server, timeout=0.2)
|
||||
|
|
|
@ -40,15 +40,17 @@ class ClientSession(BaseClientSession):
|
|||
# TODO: change to 'ping' on newer protocol (above 1.2)
|
||||
while not self.is_closing():
|
||||
if (time() - self.last_send) > self.max_seconds_idle:
|
||||
await self.send_request('server.banner')
|
||||
try:
|
||||
await self.send_request('server.banner')
|
||||
except:
|
||||
self.abort()
|
||||
raise
|
||||
await asyncio.sleep(self.max_seconds_idle//3)
|
||||
|
||||
async def create_connection(self, timeout=6):
|
||||
connector = Connector(lambda: self, *self.server)
|
||||
await asyncio.wait_for(connector.create_connection(), timeout=timeout)
|
||||
self.ping_task = asyncio.create_task(self.ping_forever())
|
||||
# tie the ping task to this connection: if the task dies for any unexpected error, abort
|
||||
self.ping_task.add_done_callback(lambda _: self.abort())
|
||||
|
||||
async def handle_request(self, request):
|
||||
controller = self.network.subscription_controllers[request.method]
|
||||
|
|
Loading…
Add table
Reference in a new issue