Support service-like wait behaviour for API service
This commit is contained in:
@@ -49,4 +49,5 @@ if __name__ == '__main__':
|
|||||||
if not conf:
|
if not conf:
|
||||||
LOG.error(_("No paste configuration found for: %s"), 'nova-api.conf')
|
LOG.error(_("No paste configuration found for: %s"), 'nova-api.conf')
|
||||||
else:
|
else:
|
||||||
apiservice.serve(conf)
|
service = apiservice.serve(conf)
|
||||||
|
service.wait()
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ def _run_app(paste_config_file):
|
|||||||
server = wsgi.Server()
|
server = wsgi.Server()
|
||||||
for app in apps:
|
for app in apps:
|
||||||
server.start(*app)
|
server.start(*app)
|
||||||
server.wait()
|
return server
|
||||||
|
|
||||||
|
|
||||||
class ApiService(object):
|
class ApiService(object):
|
||||||
@@ -68,9 +68,13 @@ class ApiService(object):
|
|||||||
|
|
||||||
def __init__(self, conf):
|
def __init__(self, conf):
|
||||||
self.conf = conf
|
self.conf = conf
|
||||||
|
self.wsgi_app = None
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
_run_app(self.conf)
|
self.wsgi_app = _run_app(self.conf)
|
||||||
|
|
||||||
|
def wait(self):
|
||||||
|
self.wsgi_app.wait()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create():
|
def create():
|
||||||
|
|||||||
Reference in New Issue
Block a user