Update __init__.py (#4877)

Cleaner exit by not throwing exception if server was not set during initialization of component (ref https://github.com/home-assistant/home-assistant/pull/4866)
pull/4886/head
Erik Eriksson 2016-12-13 17:57:33 +01:00 committed by Paulus Schoutsen
parent e4b6395250
commit 6da3e23436
1 changed files with 5 additions and 3 deletions

View File

@ -323,9 +323,11 @@ class HomeAssistantWSGI(object):
@asyncio.coroutine
def stop(self):
"""Stop the wsgi server."""
if self.server:
self.server.close()
yield from self.server.wait_closed()
yield from self.app.shutdown()
if self._handler:
yield from self._handler.finish_connections(60.0)
yield from self.app.cleanup()