set_default_executor

This commit is contained in:
Jack Robison 2022-02-20 12:45:49 -05:00
parent bed3255b89
commit 8d86b0754c
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
4 changed files with 5 additions and 2 deletions

View file

@ -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()

View file

@ -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()

View file

@ -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

View file

@ -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()