forked from LBRYCommunity/lbry-sdk
close daemon connector on server close to avoid errors on tests
This commit is contained in:
parent
510d88fff1
commit
8749c78622
2 changed files with 6 additions and 0 deletions
|
@ -57,6 +57,11 @@ class Daemon:
|
||||||
self.available_rpcs = {}
|
self.available_rpcs = {}
|
||||||
self.connector = aiohttp.TCPConnector()
|
self.connector = aiohttp.TCPConnector()
|
||||||
|
|
||||||
|
async def close(self):
|
||||||
|
if self.connector:
|
||||||
|
await self.connector.close()
|
||||||
|
self.connector = None
|
||||||
|
|
||||||
def set_url(self, url):
|
def set_url(self, url):
|
||||||
"""Set the URLS to the given list, and switch to the first one."""
|
"""Set the URLS to the given list, and switch to the first one."""
|
||||||
urls = url.split(',')
|
urls = url.split(',')
|
||||||
|
|
|
@ -146,6 +146,7 @@ class Server:
|
||||||
task.cancel()
|
task.cancel()
|
||||||
await asyncio.wait(self.cancellable_tasks)
|
await asyncio.wait(self.cancellable_tasks)
|
||||||
self.shutdown_event.set()
|
self.shutdown_event.set()
|
||||||
|
await self.daemon.close()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
|
Loading…
Reference in a new issue