frappy.client.readParameter: handle connection errors correctly

update cache in case of connection errors, as they are not handled
in the rx thread

Change-Id: Icf3377020ec314fcef2982a4e6dc64356f787273
Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/33744
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
zolliker 2024-05-22 09:34:32 +02:00
parent 63210c9924
commit b1f9c74269

View File

@ -675,9 +675,14 @@ class SecopClient(ProxyClient):
"""forced read over connection"""
try:
self.request(READREQUEST, self.identifier[module, parameter])
except SECoPError:
# error reply message is already stored as readerror in cache
pass
except SECoPError as e:
result = self.cache[module, parameter]
if e == result.readerror:
# the update was already done in the rx thread
return result
# e was not originating from a secop error message e.g. a connection problem
# -> we have to do the error update
self.updateValue(module, parameter, None, time.time(), e)
return self.cache.get((module, parameter), None)
def getParameter(self, module, parameter, trycache=False):