whaleygeek / pyenergenie

A python interface to the Energenie line of products
MIT License
81 stars 51 forks source link

Provide a safe-shutdown method, to avoid resource warnings #118

Open whaleygeek opened 5 years ago

whaleygeek commented 5 years ago

It really does depend how you are stopping the web server running. A CTRL-C will likely generate a resource warning (anecdotal evidence here too.... psf/requests#3912) and the PSF guys say 'this is only a warning, don't worry about it').

There is some advice here about how to access the shutdown() method, as I suspect because the web_console is session based (and I use cookies in session to implement the session) that Bottle is using the Requests library internally, which will suffer on an uncontrolled shutdown.

https://stackoverflow.com/questions/11282218/bottle-web-framework-how-to-stop

I'll leave these notes here, next time I do some work on web_console I'll see if I can add a'controlled server shutdown' feature that you can call from a web request (which would allow you to add a button in an admin interface to stop the server remotely, if that is what you want to achieve).

But as the PSF guys say, it's just a warning, it's sort of normal when you pull the plug on a server that is actively serving.

whaleygeek commented 5 years ago

Original report came from here: https://github.com/whaleygeek/pyenergenie/issues/109