From 7d555feba3cb995124b9433c839ee0dc483b7e7e Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Tue, 2 Jan 2024 22:05:10 +0100 Subject: [PATCH] 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 --- chia/full_node/full_node_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chia/full_node/full_node_api.py b/chia/full_node/full_node_api.py index d35af29b8cd7..51a590e63cdb 100644 --- a/chia/full_node/full_node_api.py +++ b/chia/full_node/full_node_api.py @@ -1276,7 +1276,7 @@ async def send_transaction( ) # 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: