fix 2 issues with starting stopping

- secnode devices were not disconnected before stopping
  leading to error messages
- target of secnodes not properly updated
This commit is contained in:
2024-06-07 17:08:31 +02:00
parent e121c3ca8e
commit f8440d38a4

View File

@ -165,8 +165,8 @@ class FrappyConfig(Device):
self._back_to_normal = None
while not self._shutdown_event.wait(1):
busy = session.daemon_device._controller.status >= 0
if busy and cnt < 10:
# check only every 10 sec when busy
if self._restarting or (busy and cnt < 10):
# do not check when restarting and check only every 10 sec when busy
cnt += 1
continue
if not busy and self._back_to_normal:
@ -308,7 +308,6 @@ class FrappyConfig(Device):
used_cfg[cfg] = service
for service, cfginfo in reversed(list(new_cfg.items())):
if cfginfo != all_cfg.get(service, ''):
secnode = secnodes[service]
if secnode:
secnode('') # stop previous frappy server
@ -735,7 +734,6 @@ class FrappyNode(SecNodeDevice, Moveable):
self.__log_recording = ()
def nodeStateChange(self, online, state):
# self.log.info('NODE %r %r', online, state)
if online:
super().nodeStateChange(online, state)
if self._cfgvalue is None:
@ -759,7 +757,7 @@ class FrappyNode(SecNodeDevice, Moveable):
if not running_cfg or running_cfg == self.target:
super().descriptiveDataChange(module, description)
else:
self._disconnect(True)
self._disconnect(keeptarget=True)
self._cfgvalue = running_cfg
self._set_status(status.ERROR, 'cfg changed')
@ -791,7 +789,7 @@ class FrappyNode(SecNodeDevice, Moveable):
if cfg != running_cfg:
self.disable()
if running_cfg:
self._disconnect()
self._disconnect(keeptarget=not cfg)
session.log.info('stop frappy_%s %r %r', self.service, running_cfg, cfg)
fm.do_stop(ins, self.service)
self._setROParam('target', cfg)
@ -815,12 +813,12 @@ class FrappyNode(SecNodeDevice, Moveable):
else:
uri = cfg
if uri != self.uri:
self.uri = '' # disconnect
self._disconnect(keeptarget=True)
if uri:
if is_cfg:
session.log.info('start frappy_%s', self.service)
fm.do_start(ins, self.service, cfg, logger=self.log)
self.uri = uri # connect
self.uri = uri # connect (or disconnect)
self._cfgvalue = cfg
if self._cache:
self._cache.put(self, 'value', cfg)