forked from LBRYCommunity/lbry-sdk
set_default_executor
This commit is contained in:
parent
bed3255b89
commit
8d86b0754c
4 changed files with 5 additions and 2 deletions
|
@ -1682,6 +1682,7 @@ class BlockProcessor:
|
|||
|
||||
def run(self):
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.set_default_executor(self._chain_executor)
|
||||
|
||||
def __exit():
|
||||
raise SystemExit()
|
||||
|
|
|
@ -265,6 +265,7 @@ class BlockchainReaderServer(BlockchainReader):
|
|||
|
||||
def run(self):
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.set_default_executor(self._executor)
|
||||
|
||||
def __exit():
|
||||
raise SystemExit()
|
||||
|
|
|
@ -348,7 +348,7 @@ class HubDB:
|
|||
|
||||
async def fs_getclaimbyid(self, claim_id):
|
||||
return await asyncio.get_event_loop().run_in_executor(
|
||||
None, self._fs_get_claim_by_hash, bytes.fromhex(claim_id)
|
||||
self._executor, self._fs_get_claim_by_hash, bytes.fromhex(claim_id)
|
||||
)
|
||||
|
||||
def get_claim_txo_amount(self, claim_hash: bytes) -> Optional[int]:
|
||||
|
@ -967,7 +967,7 @@ class HubDB:
|
|||
tx_infos = {}
|
||||
for tx_hash in tx_hashes:
|
||||
tx_infos[tx_hash] = await asyncio.get_event_loop().run_in_executor(
|
||||
None, self._get_transaction_and_merkle, tx_hash
|
||||
self._executor, self._get_transaction_and_merkle, tx_hash
|
||||
)
|
||||
await asyncio.sleep(0)
|
||||
return tx_infos
|
||||
|
|
|
@ -345,6 +345,7 @@ class ElasticWriter(BlockchainReader):
|
|||
|
||||
def run(self, reindex=False):
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.set_default_executor(self._executor)
|
||||
|
||||
def __exit():
|
||||
raise SystemExit()
|
||||
|
|
Loading…
Reference in a new issue