Better handle error on webserver startup. Resolve #2057
This commit is contained in:
parent
0e401017ab
commit
e9212ff898
1 changed files with 13 additions and 4 deletions
|
|
@ -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):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue