Merge pull request #10375 from terminalmage/systemd-daemon-notify

On systemd hosts, notify systemd when master is started
This commit is contained in:
Joseph Hall 2014-02-12 09:05:01 -07:00
commit baf9b7355f

View File

@ -62,6 +62,13 @@ try:
except ImportError:
HAS_HALITE = False
try:
import systemd.daemon
HAS_PYTHON_SYSTEMD = True
except ImportError:
HAS_PYTHON_SYSTEMD = False
log = logging.getLogger(__name__)
@ -466,6 +473,13 @@ class ReqServer(object):
self.workers.bind(self.w_uri)
try:
if HAS_PYTHON_SYSTEMD and systemd.daemon.booted():
systemd.daemon.notify('READY=1')
except SystemError:
# Daemon wasn't started by systemd
pass
while True:
try:
zmq.device(zmq.QUEUE, self.clients, self.workers)