Better handle error on webserver startup. Resolve #2057

This commit is contained in:
Griatch 2022-02-13 12:35:33 +01:00
parent 0e401017ab
commit e9212ff898

View file

@ -276,16 +276,25 @@ class WSGIWebServer(internet.TCPServer):
Start the pool after the service starts. Start the pool after the service starts.
""" """
super().startService() try:
self.pool.start() super().startService()
self.pool.start()
except Exception:
logger.log_trace("Webserver did not start correctly. Disabling.")
self.stopService()
def stopService(self): def stopService(self):
""" """
Safely stop the pool after the service stops. Safely stop the pool after the service stops.
""" """
super().stopService() try:
self.pool.stop() super().stopService()
except Exception:
logger.log_trace("Webserver stopService error.")
finally:
if self.pool.started:
self.pool.stop()
class PrivateStaticRoot(static.File): class PrivateStaticRoot(static.File):