close daemon connector on server close to avoid errors on tests

This commit is contained in:
Victor Shyba 2019-07-14 00:46:22 -03:00 committed by Lex Berezhny
parent 510d88fff1
commit 8749c78622
2 changed files with 6 additions and 0 deletions

View file

@ -57,6 +57,11 @@ class Daemon:
self.available_rpcs = {}
self.connector = aiohttp.TCPConnector()
async def close(self):
if self.connector:
await self.connector.close()
self.connector = None
def set_url(self, url):
"""Set the URLS to the given list, and switch to the first one."""
urls = url.split(',')

View file

@ -146,6 +146,7 @@ class Server:
task.cancel()
await asyncio.wait(self.cancellable_tasks)
self.shutdown_event.set()
await self.daemon.close()
def run(self):
loop = asyncio.get_event_loop()