Ensure glance-api application is "greened"
Fixes bug 1052640 Avoid unresponsiveness during long-lived I/O-bound operations by ensuring that the standard socket libraries are monkey-patched in all code-paths. Change-Id: If672c26f2b462d1abcfc86e20256957f73f98fde
This commit is contained in:
parent
923b901f85
commit
8f42dacecd
@ -193,7 +193,7 @@ class Server(object):
|
||||
|
||||
if CONF.workers == 0:
|
||||
# Useful for profiling, test, debug etc.
|
||||
self.pool = eventlet.GreenPool(size=self.threads)
|
||||
self.pool = self.create_pool()
|
||||
self.pool.spawn_n(self._single_run, self.app_func(), self.sock)
|
||||
return
|
||||
else:
|
||||
@ -204,6 +204,10 @@ class Server(object):
|
||||
while len(self.children) < CONF.workers:
|
||||
self.run_child()
|
||||
|
||||
def create_pool(self):
|
||||
eventlet.patcher.monkey_patch(all=False, socket=True)
|
||||
return eventlet.GreenPool(size=self.threads)
|
||||
|
||||
def wait_on_children(self):
|
||||
while self.running:
|
||||
try:
|
||||
@ -266,8 +270,7 @@ class Server(object):
|
||||
except Exception:
|
||||
msg = _("eventlet 'poll' hub is not available on this platform")
|
||||
raise exception.WorkerCreationFailure(reason=msg)
|
||||
eventlet.patcher.monkey_patch(all=False, socket=True)
|
||||
self.pool = eventlet.GreenPool(size=self.threads)
|
||||
self.pool = self.create_pool()
|
||||
try:
|
||||
eventlet.wsgi.server(self.sock, self.app_func(),
|
||||
log=WritableLogger(self.logger), custom_pool=self.pool)
|
||||
|
Loading…
Reference in New Issue
Block a user