WebThingsIO / gateway-addon-python

Python bindings for developing add-ons for WebThings Gateway
Mozilla Public License 2.0
16 stars 10 forks source link

Restart the addon? #85

Closed createcandle closed 4 years ago

createcandle commented 4 years ago

Is there a recommended way that an addon can restart itself? I tried using sys.exit() in the hopes that the gateway would then restart it as if it had crashed. But it did nothing.

mrstegeman commented 4 years ago

If the add-on process exits with any code besides 100, the gateway should automatically restart. You need to make sure you're killing off every thread and process owned by the add-on, though. You should see a message in the gateway log, similar to: Plugin: <id> died, code = <code> restarting after <X>