Optimize sub process startup with workers

This commit is contained in:
Thomas Nagy 2019-05-27 18:05:02 +02:00
parent 503b09c984
commit 92e9764f58
No known key found for this signature in database
GPG Key ID: 49B4C67C05277AAA
2 changed files with 5 additions and 1 deletions

View File

@ -885,7 +885,7 @@ def get_process():
except IndexError:
filepath = os.path.dirname(os.path.abspath(__file__)) + os.sep + 'processor.py'
cmd = [sys.executable, '-c', readf(filepath)]
return subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, bufsize=0)
return subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, bufsize=0, close_fds=True)
def run_prefork_process(cmd, kwargs, cargs):
"""

View File

@ -27,6 +27,10 @@ def run():
[cmd, kwargs, cargs] = cPickle.loads(base64.b64decode(txt))
cargs = cargs or {}
if not 'close_fds' in kwargs:
# workers have no fds
kwargs['close_fds'] = False
ret = 1
out, err, ex, trace = (None, None, None, None)
try: