frappy_psi/sea: yet another fix: BUSY after write target

it seems update_is_running runs in parallel to write_target
and read_status can not run before write_target has finished
due to locks -> call read_status within write_target
This commit is contained in:
zolliker 2024-08-20 11:39:04 +02:00
parent bfbb8172e0
commit 7536454e96

View File

@ -724,16 +724,23 @@ class SeaDrivable(SeaReadable, Drivable):
self._is_running = None
self._bad_start = 0
self.io.query(f'run {self.sea_object} {value}')
if not self._is_running:
self.log.warn('is_running is not set after run')
if self._is_running:
self.read_status()
if not self.isDriving():
self.log.warn('status is not set after run')
self._bad_start = time.time()
self.status = BUSY, 'changed target'
return value
def update_is_running(self, value, timestamp, readerror):
if not readerror:
if readerror:
self.log.warn('error in update_is_running %r', readerror)
else:
self._is_running = value
try:
self.read_status()
except Exception as e:
self.log.info('read_status failed %r', e)
def read_status(self):
status = super().read_status()