mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
only create sockets in forked processes not in master
This commit is contained in:
parent
792edf6d9a
commit
0a0ef9d140
@ -10,6 +10,7 @@ import signal
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
import socket
|
||||||
|
|
||||||
from gunicorn.errors import HaltServer, AppImportError
|
from gunicorn.errors import HaltServer, AppImportError
|
||||||
from gunicorn.pidfile import Pidfile
|
from gunicorn.pidfile import Pidfile
|
||||||
@ -152,7 +153,8 @@ class Arbiter(object):
|
|||||||
for fd in os.environ.pop('GUNICORN_FD').split(','):
|
for fd in os.environ.pop('GUNICORN_FD').split(','):
|
||||||
fds.append(int(fd))
|
fds.append(int(fd))
|
||||||
|
|
||||||
self.LISTENERS = sock.create_sockets(self.cfg, self.log, fds)
|
if not (self.cfg.reuse_port and hasattr(socket, 'SO_REUSEPORT')):
|
||||||
|
self.LISTENERS = sock.create_sockets(self.cfg, self.log, fds)
|
||||||
|
|
||||||
listeners_str = ",".join([str(lnr) for lnr in self.LISTENERS])
|
listeners_str = ",".join([str(lnr) for lnr in self.LISTENERS])
|
||||||
self.log.debug("Arbiter booted")
|
self.log.debug("Arbiter booted")
|
||||||
@ -579,6 +581,8 @@ class Arbiter(object):
|
|||||||
try:
|
try:
|
||||||
util._setproctitle("worker [%s]" % self.proc_name)
|
util._setproctitle("worker [%s]" % self.proc_name)
|
||||||
self.log.info("Booting worker with pid: %s", worker.pid)
|
self.log.info("Booting worker with pid: %s", worker.pid)
|
||||||
|
if self.cfg.reuse_port:
|
||||||
|
worker.sockets = sock.create_sockets(self.cfg, self.log)
|
||||||
self.cfg.post_fork(self, worker)
|
self.cfg.post_fork(self, worker)
|
||||||
worker.init_process()
|
worker.init_process()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user