Fail on start if any child threads can't start.

This commit is contained in:
Tyson Clugg 2015-12-14 13:07:25 +11:00
parent d7dde53bdc
commit 40d0bf27a6
2 changed files with 6 additions and 0 deletions

View file

@ -11,6 +11,7 @@ develop
`python_platform_implementation` environment marker.
* Moved repository to https://github.com/django-ddp/django-ddp (new
Github organisation).
* Fail on start if any child threads can't start (eg: port in use).
* Add missing versions and dates to the change log, and note on Semantic
Versioning.
* Back to universal wheels, thanks to PEP-0496 environment markers.

View file

@ -207,7 +207,12 @@ class DDPLauncher(object):
self.print('=> Started PostgresGreenlet.')
for server in self.servers:
thread = gevent.spawn(server.serve_forever)
gevent.sleep() # yield to thread in case it can't start
self.threads.append(thread)
if thread.dead:
# thread died, stop everything and re-raise the exception.
self.stop()
thread.get()
if isinstance(server, geventwebsocket.WebSocketServer):
self.print(
'=> App running at: %s://%s:%d/' % (