Hi-
I have a concurrent thread that synchronizes the state on the server. In the plugin configuration, I'm allowing to edit the polling interval. How do I restart the concurrent thread when the polling interval changes?
Thanks.
Mike
def runConcurrentThread(self):
try:
while True:
if (self.pollFrequency > 0.0) and (time.time() > self.next_poll):
self.next_poll = time.time() + self.pollFrequency
for dev in indigo.devices.iter("self"):
if (dev.deviceTypeId == "twilioNumber"):
self.checkMessages(dev)
self.sleep(60.0)
def closedPrefsConfigUi(self, valuesDict, userCancelled):
if not userCancelled:
self.pollFrequency = float(self.pluginPrefs.get('pollFrequency', "10")) * 60.0
self.logger.debug(u"pollFrequency = " + str(self.pollFrequency))
self.next_poll = time.time()
Users browsing this forum: No registered users and 11 guests