Closed whittedb closed 6 years ago
There is a stop() method on the controller - is that not enough for your needs?
That's what I'm using but it's called "after" the disconnect from MQTT.
I see. I'm guessing that reason behind it - if stop() takes too much time - we still want to disconnect MQTT before Polyglot forcefully kills us.
More than timing, if stop locks up, or node server otherwise is not functioning, this might prevent restart. To do it properly, you'd have to call stop from separate thread with timeout. While doable, seems like an over kill here. Technically, restart is abnormal condition. Trying to synchronize state in abnormal condition probably isn't worth the trouble.
Good point @firstone. I suppose that if the controller is not online, then the rest of the nodes aren't either. I can live with that. Thanks for the input.
It would be nice to have the stop observers called prior to MQTT shutdown so drivers can be updated before shutting down. Use case: Update a status in ISY indicating the node is not available.
Are there any implications to just moving the notification loop above the MQTT shutdown code? I'm not sure if the order of those actions was intentional for some reason.