mirror of
https://github.com/xcat2/confluent.git
synced 2026-09-04 20:17:58 +00:00
Do not cache an SDR that failed to build
init_sdr assigned self._sdr before initialize() ran, so a failure left the half built object in the cache. The next call saw a non-None _sdr and handed back that partial repository rather than trying again. The visible symptom is a first call raising and the second appearing to succeed. The real cost is on a bmc where the read fails once: the client keeps the incomplete sdr for the life of the session and every later sensor lookup answers from it without complaint.
This commit is contained in:
@@ -605,8 +605,12 @@ class Command(object):
|
||||
if hasattr(self._oem, 'init_sdr'):
|
||||
self._sdr = await self._oem.init_sdr()
|
||||
else:
|
||||
self._sdr = sdr.SDR(self, self._sdrcachedir)
|
||||
await self._sdr.initialize()
|
||||
# Assigned only once it is built. Assigning first meant a
|
||||
# failed initialize left the half built object cached, and
|
||||
# every later call returned that instead of retrying.
|
||||
newsdr = sdr.SDR(self, self._sdrcachedir)
|
||||
await newsdr.initialize()
|
||||
self._sdr = newsdr
|
||||
return self._sdr
|
||||
|
||||
async def get_event_constants(self):
|
||||
|
||||
Reference in New Issue
Block a user