2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-08-28 01:26:44 +00:00

Await the remaining reachable coroutines

sockapi sent its collective refusal without awaiting tlvdata.send. redfish
handle_sensors returned a coroutine from most branches and None from the short
ones, so the caller's await raised TypeError; it is a coroutine throughout
now. console send_payload waited for a response without awaiting the wait.

Two suppressions are pyrefly limitations rather than bugs: Session defines an
async __new__, and the keepalive registry holds coroutine functions in an
untyped dict.
This commit is contained in:
Markus Hilger
2026-08-10 04:39:28 +02:00
parent 2ea7aed2cc
commit 92c9abc74a
4 changed files with 14 additions and 8 deletions
+4 -1
View File
@@ -73,6 +73,9 @@ class Console(object):
password = self.password
port = self.port
kg = self.kg
# Session defines an async __new__, so the constructor call is a
# coroutine, which pyrefly does not model.
# pyrefly: ignore[not-async]
self.ipmi_session = await session.Session(
bmc=bmc, userid=userid, password=password, port=port, kg=kg)
# induce one iteration of the loop, now that we would be
@@ -301,7 +304,7 @@ class Console(object):
async def send_payload(self, payload, payload_type=1, retry=True,
needskeepalive=False):
while not (self.connected or self.broken):
session.Session.wait_for_rsp(timeout=10)
await session.Session.wait_for_rsp(timeout=10)
if self.ipmi_session is None or not self.ipmi_session.logged:
await self._print_error('Session no longer connected')
raise exc.IpmiException('Session no longer connected')
@@ -1354,6 +1354,9 @@ class Session(object):
# deregister
continue
if callable(cmd):
# registered callables are coroutine functions,
# but the registry itself is untyped
# pyrefly: ignore[not-async]
await cmd()
continue
keptalive = True
@@ -1133,23 +1133,23 @@ class IpmiHandler:
return await self._show_all_storage()
def handle_sensors(self):
async def handle_sensors(self):
if self.element[-1] == '':
self.element = self.element[:-1]
if len(self.element) < 3:
return
self.sensorcategory = self.element[2]
if self.sensorcategory == 'normalized':
return self.read_normalized(self.element[-1])
return await self.read_normalized(self.element[-1])
# list sensors per category
if len(self.element) == 3 and self.element[-2] == 'hardware':
if self.sensorcategory == 'leds':
return self.list_leds()
return self.list_sensors()
return await self.list_leds()
return await self.list_sensors()
elif len(self.element) == 4: # resource requested
if self.sensorcategory == 'leds':
return self.read_leds(self.element[-1])
return self.read_sensors(self.element[-1])
return await self.read_leds(self.element[-1])
return await self.read_sensors(self.element[-1])
def match_sensor(self, sensor):
if self.sensorcategory == 'all':
+1 -1
View File
@@ -156,7 +156,7 @@ async def sessionhdl(connection, authname, skipauth=False, cert=None):
return await collective.handle_connection(
connection, None, request['collective'], local=True)
else:
tlvdata.send(
await tlvdata.send(
connection,
{'collective': {
'error': 'collective management commands '