Commit 247ebba3 authored by Denis Bilenko's avatar Denis Bilenko

pywsgi: set max_accept to 1 if environ['wsgi.multiprocess'] is true (e.g. in...

pywsgi: set max_accept to 1 if environ['wsgi.multiprocess'] is true (e.g. in case of gunicorn having >1 workers)
parent 44f41fe1
...@@ -12,6 +12,7 @@ from urllib import unquote ...@@ -12,6 +12,7 @@ from urllib import unquote
from gevent import socket from gevent import socket
import gevent import gevent
from gevent.server import StreamServer from gevent.server import StreamServer
from gevent import server
from gevent.hub import GreenletExit from gevent.hub import GreenletExit
...@@ -527,6 +528,7 @@ class WSGIServer(StreamServer): ...@@ -527,6 +528,7 @@ class WSGIServer(StreamServer):
else: else:
self.log = log self.log = log
self.set_environ(environ) self.set_environ(environ)
self.set_max_accept()
def set_environ(self, environ=None): def set_environ(self, environ=None):
if environ is not None: if environ is not None:
...@@ -542,6 +544,13 @@ class WSGIServer(StreamServer): ...@@ -542,6 +544,13 @@ class WSGIServer(StreamServer):
if self.environ.get('wsgi.errors') is None: if self.environ.get('wsgi.errors') is None:
self.environ['wsgi.errors'] = sys.stderr self.environ['wsgi.errors'] = sys.stderr
def set_max_accept(self):
if self.max_accept is None:
if self.environ.get('wsgi.multiprocess'):
self.max_accept = 1
else:
self.max_accept = server.DEFAULT_MAX_ACCEPT
def get_environ(self): def get_environ(self):
return self.environ.copy() return self.environ.copy()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment