Prevent removal unix socket for reuse_port

If you have two (or more) instances of gunicorn that use `reuse-port` and bind to single unix socket all work until one of gunicorn will stopped. Because the first stopped removes unix socket file and other instances can't longer process requests.
This commit is contained in:
Konstantin vz'One Enchant 2018-10-01 12:52:03 +03:00 committed by GitHub
parent 59bf81cb58
commit af7f158d22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -376,7 +376,11 @@ class Arbiter(object):
killed gracefully (ie. trying to wait for the current connection)
"""
unlink = self.reexec_pid == self.master_pid == 0 and not self.systemd
unlink = (
self.reexec_pid == self.master_pid == 0
and not self.systemd
and not self.cfg.reuse_port
)
sock.close_sockets(self.LISTENERS, unlink)
self.LISTENERS = []