Browse Source

Ensure there's always an http server object

It's possible for a test to complete before python gets around to
actually starting the webapp run thread.  Make sure that the
object referenced in the stop method is always instantiated to
avoid "AttributeError: 'WebApp' object has no attribute 'server'"
errors.

Also, mark the webapp thread as daemon on general principle.

Change-Id: I9b4c0c20a98d5429c299748178e31baf8b6912d9
changes/92/79792/1
James E. Blair 8 years ago
parent
commit
f31b3436eb
  1. 5
      zuul/webapp.py

5
zuul/webapp.py

@ -26,10 +26,11 @@ class WebApp(threading.Thread):
threading.Thread.__init__(self)
self.scheduler = scheduler
self.port = port
def run(self):
self.daemon = True
self.server = httpserver.serve(self.app, host='0.0.0.0',
port=self.port, start_loop=False)
def run(self):
self.server.serve_forever()
def stop(self):

Loading…
Cancel
Save