Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@qi.bind()
def disconnectSubscribers(self):
""" disconnect all subscribers from callbacks """
qi.info(self.serviceName, "DISCONNECTING SUBSCRIBERS")
if self.subscribeToggle:
for event in self.subscribers.keys():
future = qi.async(self.disconnectSubscriber, event, delay = 0)
future.wait(1000) # add a timeout to avoid deadlock
if not future.isFinished():
qi.error(self.serviceName, "disconnectSubscribers", "Failed disconnecting %s subscribers" % event)
self.subscribeToggle = False