cleanup code per pr comments
This commit is contained in:
parent
d0314ac70c
commit
77fa5e9782
2 changed files with 11 additions and 20 deletions
|
@ -6,7 +6,6 @@ import logging
|
||||||
import tempfile
|
import tempfile
|
||||||
import functools
|
import functools
|
||||||
import asyncio
|
import asyncio
|
||||||
import grpc
|
|
||||||
from asyncio.runners import _cancel_all_tasks # type: ignore
|
from asyncio.runners import _cancel_all_tasks # type: ignore
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.case import _Outcome
|
from unittest.case import _Outcome
|
||||||
|
@ -38,8 +37,6 @@ from lbry.extras.daemon.storage import SQLiteStorage
|
||||||
from lbry.blob.blob_manager import BlobManager
|
from lbry.blob.blob_manager import BlobManager
|
||||||
from lbry.stream.reflector.server import ReflectorServer
|
from lbry.stream.reflector.server import ReflectorServer
|
||||||
from lbry.blob_exchange.server import BlobServer
|
from lbry.blob_exchange.server import BlobServer
|
||||||
from lbry.schema.types.v2 import hub_pb2_grpc
|
|
||||||
from lbry.schema.types.v2 import hub_pb2
|
|
||||||
|
|
||||||
|
|
||||||
class ColorHandler(logging.StreamHandler):
|
class ColorHandler(logging.StreamHandler):
|
||||||
|
@ -346,18 +343,19 @@ class IntegrationTestCase(AsyncioTestCase):
|
||||||
""" Ask lbrycrd to generate some blocks and wait until ledger has them. """
|
""" Ask lbrycrd to generate some blocks and wait until ledger has them. """
|
||||||
prepare = self.ledger.on_header.where(self.blockchain.is_expected_block)
|
prepare = self.ledger.on_header.where(self.blockchain.is_expected_block)
|
||||||
height = self.blockchain.block_expected
|
height = self.blockchain.block_expected
|
||||||
self.conductor.spv_node.server.es_synchronized.clear()
|
server = self.conductor.spv_node.server
|
||||||
self.conductor.spv_node.server.go_hub_synchronized.clear()
|
server.es_synchronized.clear()
|
||||||
self.conductor.spv_node.server.synchronized.clear()
|
server.go_hub_synchronized.clear()
|
||||||
|
server.synchronized.clear()
|
||||||
await self.blockchain.generate(blocks)
|
await self.blockchain.generate(blocks)
|
||||||
await prepare # no guarantee that it didn't happen already, so start waiting from before calling generate
|
await prepare # no guarantee that it didn't happen already, so start waiting from before calling generate
|
||||||
while True:
|
while True:
|
||||||
await self.conductor.spv_node.server.synchronized.wait()
|
await server.synchronized.wait()
|
||||||
self.conductor.spv_node.server.es_synchronized.clear()
|
server.es_synchronized.clear()
|
||||||
self.conductor.spv_node.server.go_hub_synchronized.clear()
|
server.go_hub_synchronized.clear()
|
||||||
self.conductor.spv_node.server.synchronized.clear()
|
server.synchronized.clear()
|
||||||
if self.conductor.spv_node.server.db.db_height >= height and \
|
if server.db.db_height >= height and \
|
||||||
self.conductor.spv_node.server._go_hub_height == self.conductor.spv_node.server.db.db_height == self.conductor.spv_node.server._es_height:
|
server._go_hub_height == server.db.db_height == server._es_height:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,7 @@ from typing import Dict, Optional, Tuple
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import grpc
|
import grpc
|
||||||
from lbry.schema.types.v2 import hub_pb2_grpc
|
from lbry.schema.types.v2 import hub_pb2_grpc
|
||||||
from lbry.schema.types.v2.hub_pb2 import SearchRequest
|
from lbry.schema.types.v2.hub_pb2 import SearchRequest, StringArray
|
||||||
from lbry.schema.types.v2.hub_pb2 import StringArray
|
|
||||||
|
|
||||||
from lbry import __version__
|
from lbry import __version__
|
||||||
from lbry.utils import resolve_host
|
from lbry.utils import resolve_host
|
||||||
|
@ -479,12 +478,6 @@ class Network:
|
||||||
def claim_search(self, session_override=None, **kwargs):
|
def claim_search(self, session_override=None, **kwargs):
|
||||||
return self.rpc('blockchain.claimtrie.search', kwargs, False, session_override)
|
return self.rpc('blockchain.claimtrie.search', kwargs, False, session_override)
|
||||||
|
|
||||||
async def new_resolve(self, server, urls):
|
|
||||||
message = {"method": "resolve", "params": {"urls": urls, "protobuf": True}}
|
|
||||||
async with self.aiohttp_session.post(server, json=message) as r:
|
|
||||||
result = await r.json()
|
|
||||||
return result['result']
|
|
||||||
|
|
||||||
async def new_claim_search(self, server, **kwargs):
|
async def new_claim_search(self, server, **kwargs):
|
||||||
async with grpc.aio.insecure_channel(server) as channel:
|
async with grpc.aio.insecure_channel(server) as channel:
|
||||||
stub = hub_pb2_grpc.HubStub(channel)
|
stub = hub_pb2_grpc.HubStub(channel)
|
||||||
|
|
Loading…
Add table
Reference in a new issue