From dfde5736e982fd543f08a85eb6f91ad3b8526e8a Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Mon, 10 Aug 2026 04:39:28 +0200 Subject: [PATCH] Stop the aiohmi event loop from spinning when it has nothing to do Command.eventloop called wait_for_rsp with no timeout. With nothing waiting or being kept alive there is no deadline to derive one from, so it returns without suspending and the loop runs flat out, measured at over 100000 iterations in two tenths of a second. MAX_IDLE gives it something to wait on, as a ceiling rather than a fixed delay: real deadlines still shorten it and an arriving packet still ends it early. --- confluent_server/aiohmi/ipmi/command.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/confluent_server/aiohmi/ipmi/command.py b/confluent_server/aiohmi/ipmi/command.py index 9d7f55b1..8ffb391d 100644 --- a/confluent_server/aiohmi/ipmi/command.py +++ b/confluent_server/aiohmi/ipmi/command.py @@ -209,7 +209,12 @@ class Command(object): @classmethod async def eventloop(cls): while True: - await session.Session.wait_for_rsp() + # A ceiling rather than no timeout at all: with nothing waiting or + # being kept alive, wait_for_rsp has nothing to wait on and returns + # at once, which would make this a busy loop. Sessions still shorten + # it to their own deadlines, and an arriving packet still ends the + # wait early. + await session.Session.wait_for_rsp(timeout=session.MAX_IDLE) @classmethod async def wait_for_rsp(cls, timeout):