Skip to content

Commit

Permalink
Spin slower send_transaction() (#17166)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
arvidn authored Jan 2, 2024
1 parent 507899f commit 7d555fe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion chia/full_node/full_node_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 7d555fe

Please sign in to comment.