forked from LBRYCommunity/lbry-sdk
fix test
This commit is contained in:
parent
46ce175481
commit
d7e50b269f
2 changed files with 5 additions and 4 deletions
|
@ -218,7 +218,7 @@ class BlockchainReaderServer(BlockchainReader):
|
||||||
t = self.cancellable_tasks.pop()
|
t = self.cancellable_tasks.pop()
|
||||||
if not t.done():
|
if not t.done():
|
||||||
t.cancel()
|
t.cancel()
|
||||||
self.session_manager.search_index.stop()
|
await self.session_manager.search_index.stop()
|
||||||
self.db.close()
|
self.db.close()
|
||||||
if self.prometheus_server:
|
if self.prometheus_server:
|
||||||
await self.prometheus_server.stop()
|
await self.prometheus_server.stop()
|
||||||
|
|
|
@ -92,10 +92,11 @@ class SearchIndex:
|
||||||
await self.sync_client.indices.refresh(self.index)
|
await self.sync_client.indices.refresh(self.index)
|
||||||
return acked
|
return acked
|
||||||
|
|
||||||
def stop(self):
|
async def stop(self):
|
||||||
clients = [self.sync_client, self.search_client]
|
clients = [c for c in (self.sync_client, self.search_client) if c is not None]
|
||||||
self.sync_client, self.search_client = None, None
|
self.sync_client, self.search_client = None, None
|
||||||
return asyncio.ensure_future(asyncio.gather(*(client.close() for client in clients)))
|
if clients:
|
||||||
|
await asyncio.gather(*(client.close() for client in clients))
|
||||||
|
|
||||||
def delete_index(self):
|
def delete_index(self):
|
||||||
return self.sync_client.indices.delete(self.index, ignore_unavailable=True)
|
return self.sync_client.indices.delete(self.index, ignore_unavailable=True)
|
||||||
|
|
Loading…
Add table
Reference in a new issue