Spin slower send_transaction() (#17166)

we currenly spin-wait for hearing back whether a transaction made it into the mempool or not (in FullNodeAPI.send_transaction()). We currently spin in a very tight loop, which appears to hog a significant amount of CPU. Increase the sleep to spin slower
This commit is contained in:
Arvid Norberg 2024-01-02 22:05:10 +01:00 committed by GitHub
parent 507899ff19
commit 7d555feba3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1276,7 +1276,7 @@ class FullNodeAPI:
)
# Waits for the transaction to go into the mempool, times out after 45 seconds.
status, error = None, None
sleep_time = 0.01
sleep_time = 0.5
for i in range(int(45 / sleep_time)):
await asyncio.sleep(sleep_time)
for potential_name, potential_status, potential_error in self.full_node.transaction_responses: