frappy.client: fix the case then timestamp is missing

the previous version failed when timestamp was missing

Change-Id: I77e1fb81b19fb4ee2749d731bafacbac46132f8e
Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/32404
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
zolliker 2023-10-25 10:40:07 +02:00
parent e3cb5d2e60
commit 416fe6ddc0

View File

@ -391,16 +391,17 @@ class SecopClient(ProxyClient):
else:
module_param = self.internal.get(f'{ident}:value', None)
if module_param is not None:
now = time.time()
if action.startswith(ERRORPREFIX):
timestamp = data[2].get('t', None)
timestamp = data[2].get('t', now)
readerror = frappy.errors.make_secop_error(*data[0:2])
value = None
else:
timestamp = data[1].get('t', None)
timestamp = data[1].get('t', now)
value = data[0]
readerror = None
module, param = module_param
timestamp = min(time.time(), timestamp) # no timestamps in the future!
timestamp = min(now, timestamp) # no timestamps in the future!
try:
self.updateValue(module, param, value, timestamp, readerror)
except KeyError: